你确实这条通知是前台服务的?
如果是,需要杀死前台服务,对应的那条通知才会消失。
你可以试试强杀掉整个app,看通知会不会消失。如果没有消失,说明这条通知不是前台服务的。普通通知需要调取消接口或者用户主动删除。
取消通知有如下 5 种方式:
点击通知栏的清除按钮,会清除所有可清除的通知
设置了 setAutoCancel() 或 FLAG_AUTO_CANCEL 的通知,点击该通知时会清除它
通过 NotificationManager 调用 cancel(int id) 方法清除指定 ID 的通知
通过 NotificationManager 调用 cancel(String tag, int id) 方法清除指定 TAG 和 ID 的通知
通过 NotificationManager 调用 cancelAll() 方法清除所有该应用之前发送的通知