gpt4 book ai didi

android - 使用 deleteIntent、cancelNotification 或两者清除来自其他应用程序的通知?

转载 作者:行者123 更新时间:2023-11-30 02:41:23 26 4
gpt4 key购买 nike

Notification.deleteIntent 可以很好地清除通知,但许多生成通知的应用将此保留为空。

NotificiationListenerService.cancelNotification(pkg, tag, id) 也可以清除通知,但如果在发送 deleteIntent 后调用,有时(并非总是)会导致 PendingIntent.CanceledException。

清除来自其他应用的通知的首选逻辑是什么?

最佳答案

NotificationListenerService.cancelNotification 执行 Notification.deleteIntent。

显式使用 .deleteIntent 似乎没有任何好处。它似乎与 gmail 等谷歌应用程序中的 .cancelNotification 执行完全相同的操作,但实际上对于 facebook 等第三方应用程序的功能较少,在发送 .deleteIntent 时不会删除通知。

关于android - 使用 deleteIntent、cancelNotification 或两者清除来自其他应用程序的通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25712612/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com