通知应用程序用户清除了应用程序的状态栏通知之一

发布于 2024-11-03 22:25:43 字数 154 浏览 5 评论 0原文

当用户打开/查看状态栏通知并单击“清除”(这将清除所有状态栏通知) 创建已清除的状态栏通知之一的服务是否会收到通知,如果是,如何通知?
否则,应用程序如何知道用户已清除应用程序的状态栏通知之一? (我想我在某处读到有一种方法可以轮询通知的状态,但我不想轮询它,而是在它被清除时收到通知)

when the user opens/looks at the status bar notifications and clicks Clear (which clears all the status bar notifications)
does the service that created one of the cleared status bar notification gets informed about it and if so, how?
otherwise, how can the application know that the user has Clear'ed one of the application's status bar notification? (i think i read somewhere that there is a way to poll the status of a notification, but i prefer not to poll it but instead to be informed when it's Clear'ed)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愁杀 2024-11-10 22:25:43

使用服务时,可能最好使用单个通知,并将其标志设置为

notification.flags |= Notification.FLAG_ONGOING_EVENT | 
    Notification.FLAG_NO_CLEAR;

这样它将位于正在进行的通知组中,并且不会被清除。通过这种方式,您可以管理何时显示、显示什么、何时隐藏等。此外,因此,不会通过服务的资源调用 gc。

When using a service, probably it's better to use a single notification, and set its flag as

notification.flags |= Notification.FLAG_ONGOING_EVENT | 
    Notification.FLAG_NO_CLEAR;

so it will be in the ongoing notification group, and won't be clearable. This way you can manage when and what to show, when to hide, etc. Also, due to this, gc won't be called over your service's resources.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文