I'm creating an Android app where I use a NotificationListenerService
to try to intercept notifications.
The intent is to intercept all notifications and let them pass only those that the user has pre-registered in the application.
Until then I use the onNotificationPosted(StatusBarNotification sbn)
method to read the notification and this works to a certain extent. I can read the notification and remove it from the status bar, but the push event of all apps continues to notify (plays and vibrates).
I wonder if it's possible to manage this push notification from other apps that are not mine.
Example: The user configures in my app that only wants to receive GMAIL notification, if I receive a WhatsApp notification it should pass in my Listener
and not allow that notification to be status bar and do not be notified )