I've done some searching and have been unable to find anything even closely related.
When a user cancels a notification in Android (by swiping the notification to one side of the screen), does anyone know of clean way to detect this? I think it would be a rather handy feature in an app to be able to cancel a notification and have the app recognize this and mark something as read in the app instead of clicking the notification and opening the app to mark something as read.
Came across this question today. It looks like the second answer has an interesting solution to detect if a notification is still shown or not. This works for pre API 11 devices. Any device running API 11 or newer can use the setDeleteIntent() to fire a PendingIntent when the notification is cleared.
Luke's answer helped me with this. Thanks!
I also found this setDeleteIntent()
example which I share for everyone's reference.
how to use delete intent to perform some action on clear notification?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With