Android cancel notification

后端 未结 1 1094
旧巷少年郎
旧巷少年郎 2021-02-09 05:36

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 notifica

相关标签:
1条回答
  • 2021-02-09 06:09
    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.

    0 讨论(0)
提交回复
热议问题