Android cancellation notice

I have a background service running to receive data. I check the new data and send a status notification. Sending a notification is part of the service. When the user sees this notification, he enters the application and accepts it. This time I want to remove it from the status bar. Can I do it?

+7
source share
1 answer
if (Context.NOTIFICATION_SERVICE!=null) { String ns = Context.NOTIFICATION_SERVICE; NotificationManager nMgr = (NotificationManager) getApplicationContext().getSystemService(ns); nMgr.cancel(0); } 

write the above code in the second class and create notifications in the first class using id 0.

+14
source

All Articles