Check that Notification is active

Asked

Viewed 208 times

1

I need to identify if a Notification specifies (ID Notification) this still active in the list of notifications from Android.

Status: I have a method that cancels the Notification so far everything is working correctly, but I need to cancel the notification cancel a Countdowntimer process (at this point everything is working correctly).

Whoever can help me thank you.

Att.

  • Do you want to cancel only if it is in the list? You can cancel a notification even if it is not in the list.

  • Hello Ramaral I do not need to know if she is on the list.

  • So what’s your problem?

  • Sorry I wrote wrong thing, I need to know if she is on the list, but my problem is not to cancel because this I am already doing what I need to check if she exists.

  • How this notification is launched is through an Alarmmanager?

  • I am using Notificationmanager and Notification.Builder

Show 1 more comment

1 answer

1


That I am aware this is only possible from the API18 through the implementation of a Notificationlistenerservice or from the API23 using the method getActiveNotifications() of the Notifitionmanager.

Implement a Notificationlistenerservice is too expensive just to know if a notification is on the list.

Knowing when it is presented is easy, since it is you who launches it.
To find out if it has been canceled use the method setDeleteIntent() to indicate a Pendingintent which will be released when the user cancels it.

If it was launched and the user did not cancel it then it is in the list.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.