gpt4 book ai didi

android - Android聚合多条通知时如何动态更改通知消息?

转载 作者:太空狗 更新时间:2023-10-29 15:23:26 24 4
gpt4 key购买 nike

我正在尝试在 Android (C2DM) 中执行这个处理推送通知的简单任务:

  • 如果通知栏中没有通知,则设置为“foo A”
  • 如果通知已经存在,捕获它,阅读它的文本,然后将它更新为类似“N 条通知:foo、bar、...”的内容。这类似于当您收到一封电子邮件与多封电子邮件时,gmail 客户端在 Android 上会执行的操作

我查看了文档,阅读了 http://developer.android.com/guide/topics/ui/notifiers/notifications.html#Updating ,搜索 SO 和网络,但到目前为止,我没有看到一种方法来访问当前在通知栏中的通知。

我是否需要在别处管理计数并在用户关闭通知时重置它?没有办法读取现有的吗?

谢谢。

最佳答案

if a notification already exists, grab it, read its text, and then update it to something like "N notifications: foo, bar, ...". This is similar to what the gmail client would do on Android when you get 1 email vs multiple ones

不,不是。 Gmail 的数据库中已有此信息。它不需要“捕获[通知],阅读它的文本”。

而且,你想要的是不可能的。

Do I need to manage the count elsewhere and have it reset when the user dismisses the notification?

是的。

Is there no way to read the existing one?

没有。

关于android - Android聚合多条通知时如何动态更改通知消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4963703/

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