Skip to content Skip to sidebar Skip to footer

Android Cancel Notification

I have a background service running to get data. I check for new data and send status bar notification. Sending notification is part of the service. When user sees that notificatio

Solution 1:

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 the notifications in the first class using the id 0.


Post a Comment for "Android Cancel Notification"