Cómo bloquear las notificaciones push de Onesignal en Android?
Sé que puedo recibirlas en Broadcast
OnReceive()
pero no puedo evitar Onesignal para crear una Notification
.
Tendrá que configurar una clase OneSignal NotificationExtenderService
y agregarla a su AndroidManifest.xml
como un Service
.
import com.onesignal.OSNotificationPayload; import com.onesignal.NotificationExtenderService; public class NotificationExtenderBareBonesExample extends NotificationExtenderService { @Override protected boolean onNotificationProcessing(OSNotificationReceivedResult receivedResult) { // Read properties from result. // Returning true tells the OneSignal SDK you have processed the notification and not to display it's own. return true; } }
AndroidManifest.xml
<service android:name=".NotificationExtenderBareBonesExample" android:exported="false"> <intent-filter> <action android:name="com.onesignal.NotificationExtender" /> </intent-filter> </service>
Para obtener más información, consulte la documentación de Antecedentes de Android OneSignal para datos de fondo y notificación .