How to remove an Android notification from the notification center when the application is launched using its launch icon?

I want to delete all pending notifications if the user launches the application through the start icon. This relates to this question (iOS) How to catch all iOS Push notifications with various user actions, including clicking on the application icon , only that I do not care about any data / data from notifications.

Is it possible?

(So ​​far, I read in the docs that you can cancel certain notifications. A simple call to .clearAll () would be better)

Regards, Richard

+4
source share
2
+7

MainActivity:

NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.cancelAll();
+4

All Articles