Reputation: 8258
I'm running a service extending NotificationListenerService
:
class NotificationBlockerListenerService : NotificationListenerService() {
override fun onNotificationPosted(sbn: StatusBarNotification) {
cancelNotification(sbn.key)
}
}
I does remove correctly the notification in the notification list (this list:)
But it doesn't block the notification bubble/snack from appearing (this one:)
Is it possible to block this bubble?
Upvotes: 0
Views: 39
Reputation: 1
You could do anything if it was your push, show or not show to user as your wish. However, as it said in comments below there is no option to intercept a push from other application. Like, when push comes from FCM only Android and the application-receiver (whose push is that) can see it. You block it when it goes to Notifications, this part is made "inside the phone" by the application (or sometimes by Android) services. And it's too late, obviously, because it's already shown. Theoretically you could try to subscribe to the same notification channel as those applications use. But first, you have to find the name of the channel from every other application. And second -- I'm just not sure it's applicable (it's just from the tip of my head).
Upvotes: -1