Remove Android Notification After Tap Or Click

I recently added a notification feature for my widget and what I wanted was whenever the user clicks or taps the notification message in the notification center, it will remove itself rather than having to click the clear all button.

The secret lies in the flags of the Notification class by using Notification.FLAG_AUTO_CANCEL. However, to ensure that this works, the code has to be bitwise-or the flags like this

Pretty easy, right?

Related Posts Plugin for WordPress, Blogger...

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *