Onkar Shelke
Onkar Shelke

Reputation: 23

NotificationListenerService in Android Marshmallow

I need to clear my applications notifications when the user logout's from the app. I am not generating notifications using NotificationBuilder my notifications are directly generated from the server for the app. I am able to to clear my notifications on user logout in android lolipop and below. But for marshmallow when user gives notification access permission from settings I don't receive any notifications for marshmallow. Need some help regarding this. I am receiving notifications from Firebase.

Upvotes: 2

Views: 245

Answers (1)

Kamran Ahmed
Kamran Ahmed

Reputation: 7761

All you need to do is:

((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancelAll();

No need for notification access and all the other logics.

Upvotes: 2

Related Questions