Search code examples
androidnotificationsnotification-listener

How to know if a Notification is a persistent one using NotificationListenerService


In my app I'm using the NotificationListenerService.

How can I know if a notification that was posted is a persistent notification that cannot be swiped away, like the "WhatsApp Web is currently Active" notification.

Is it the flag FLAG_ONGOING_EVENT in the variable flags? Or is it saved somewhere else?


Solution

  • I'm gonna answer my own question. Yes it is.

    The flags FLAG_ONGOING_EVENT or FLAG_NO_CLEAR in the variable flags is how you know if a notification is persistent