I want to build an app that will cancel all notifications when they appear. So if some application displays a notification, my app will auto-close it.
How to solve this problem using NotificationListenerService ??
Put below code on onCreate of activity that you are calling on notification click
NotificationManager notifManager= (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notifManager.cancelAll();
It will clear all notification.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.