Search code examples
androidandroid-notificationsaccessibilityservice

Detect if notification has been deleted


I have the following problem. I want to detect when a notification has been removed from the notification bar.

I can scan notifications with an AccessbilityService and casting its ParcelableData to a notification

Notification notif = (Notification) event.getParcelableData();

One thought of mine was, utilizing if the PendingIntent of the notification has been clicked, but I can't find anything on how to detect that.

Any ideas? I am kind of desperate... trying it for hours now.


Solution

  • A very similar question has already been answered here on SO:

    Detect a new Android notification

    In short, it's possible to detect when a new notification appears, but that's about it. You can't detect when notifications have been dismissed.