是否可以通過程序清除通知?我嘗試了,NotificationManager但無法正常工作。我還有其他方法可以做到嗎?
3 回答

千巷貓影
TA貢獻1829條經驗 獲得超7個贊
使用以下代碼取消通知:
NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(NOTIFICATION_ID);
在此代碼中

MYYA
TA貢獻1868條經驗 獲得超4個贊
由于沒有人對此發布代碼答案:
notification.flags = Notification.FLAG_AUTO_CANCEL;
..并且如果您已經有標志,則可以像這樣執行FLAG_AUTO_CANCEL:
notification.flags = Notification.FLAG_INSISTENT | Notification.FLAG_AUTO_CANCEL;
- 3 回答
- 0 關注
- 1554 瀏覽
添加回答
舉報
0/150
提交
取消