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.
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.
as far as i know, this is impossible unless you have root, but starting from android 4.3 , which was released just yesterday, it is possible. here are some links:
android developers blog:
android developer website:
android developer website - API description:
Access to notifications
and of course, the API documentation of this new listener, in this link
This is possible if you extend the NotificationListener and do your own stuff in the callbacks: https://developer.android.com/reference/android/service/notification/NotificationListenerService.html
You can use a setDeleteIntent on the Notification.Builder:
http://developer.android.com/reference/android/app/Notification.Builder.html#setDeleteIntent(android.app.PendingIntent)
It can be use to do what you want (I guess it's too late for you but it can help someone else)