Reputation: 22076
when i am test my app in android device
, and close it, i can show it in notification area. can you tell me how can i remove from it by programatically?
Thanks nik
Upvotes: 0
Views: 471
Reputation: 792
// notification manager
_mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// clear notification in login button click
_mNotificationManager.cancel(notication_ID);
Upvotes: 0
Reputation: 10810
You have to call cancel on your NotificationManager
. The parameter of the cancel method is the ID of the notification that should be canceled. This is the API with the cancel method.
UPDATE:
For example:
// Creates a notification
private static final int MY_NOTIFICATION_ID= 1234;
NotificationManager mNotificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(MY_NOTIFICATION_ID, notification);
// Removes the notification from the notification bar
mNotificationManager.cancel(MY_NOTIFICATION_ID);
Upvotes: 1