如果有多个通知,如何给出计数器

发布于 2024-12-01 10:55:17 字数 107 浏览 0 评论 0原文

我已经使用 C2dm 实现了 PushNotification。我也收到 c2dm 的通知。我的问题是,当我收到多个通知时,我想给出一个计数器,我的意思是“您有一个通知(计数)”。我怎样才能实现这个。

I have implemented PushNotification Using C2dm. I am getting notification from c2dm also. My problem is I want to give a counter when I get more than one notifications, I mean like "You have a Notification(count)". How can I implement this.

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

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

发布评论

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

评论(4

硪扪都還晓 2024-12-08 10:55:17

您可以将数字值设置到通知对象中,

Notification notifyDetails = new Notification(R.drawable.alarm,intent.getExtras().getString(KEY_TITLE),System.currentTimeMillis());
notifyDetails.number = 1; ////// here you can pass the counter value which will so you the number 

这里是链接

http://developer.android.com/reference/android/app/Notification.html#number

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

Android 通知条数

you can do to set the number value into the Notification object

Notification notifyDetails = new Notification(R.drawable.alarm,intent.getExtras().getString(KEY_TITLE),System.currentTimeMillis());
notifyDetails.number = 1; ////// here you can pass the counter value which will so you the number 

here is the link

http://developer.android.com/reference/android/app/Notification.html#number

http://developer.android.com/guide/topics/ui/notifiers/notifications.html

Android Notification Bar Number

回眸一笑 2024-12-08 10:55:17

您是否在寻找 Notification#number

Are you looking for Notification#number?

场罚期间 2024-12-08 10:55:17
NotificationManager notificationManager =(NotificationManager)context.getSystemService(NOTIFICATION_SERVICE);
notification.setNumber(1);
NotificationManager notificationManager =(NotificationManager)context.getSystemService(NOTIFICATION_SERVICE);
notification.setNumber(1);
仲春光 2024-12-08 10:55:17
NotificationManager notificationManager=(NotificationManager)context.getSystemService(NOTIFICATION_SERVICE);

这将创建 notificationManager 类实例。然后您将拥有可以进行任何调整的通知对象。要设置您收到的消息数量,只需设置以下内容:

notification.setNumber(1);
NotificationManager notificationManager=(NotificationManager)context.getSystemService(NOTIFICATION_SERVICE);

This creates the notificationManager class instance. Then you will have notification object with which you can do any adjustment. To set the number of the messages you have received, simply set this:

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