Android notification doesn't disappear after clicking the notifcation Android notification doesn't disappear after clicking the notifcation android android

Android notification doesn't disappear after clicking the notifcation


While building Notification by NotificationBuilder you can use notificationBuilder.setAutoCancel(true);.


notification.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL

From the documentation:

Bit to be bitwise-ored into the flags field that should be set if the notification should be canceled when it is clicked by the user


// Uses the default lighting schemenotification.defaults |= Notification.DEFAULT_LIGHTS;// Will show lights and make the notification disappear when the presses itnotification.flags |= Notification.FLAG_AUTO_CANCEL | Notification.FLAG_SHOW_LIGHTS;