I send a few notification on the notification bar, i wanted to clear all of it when one of the notification is clicked. For now I clear one by one by using Flag. I know
You should use a pending intent that sends a broadcast and then put in place a broadcast receiver that will cancel all your notifications. It is best to memorize all notifications IDs and delete them one by one.
My solution is to call it at onResume()
.
@Override
protected void onResume() {
super.onResume();
// Clear all notification
NotificationManager nMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nMgr.cancelAll();
}