Clear old notifications the moment you enter the app

Asked

Viewed 692 times

0

Someone knows how to clear old notifications from my app from the moment I enter the app through the Icon, not the notification itself. Whatsapp does this on android, but can’t find a way to work with it, thanks.

1 answer

2


You can put this on the onCreate of your Thread UI:

NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
nMgr.cancelAll();

The system will fetch all active notifications and clear them.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.