Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/220.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如果存在多个通知,如何给出计数器_Android_Notifications_Push Notification - Fatal编程技术网

Android 如果存在多个通知,如何给出计数器

Android 如果存在多个通知,如何给出计数器,android,notifications,push-notification,Android,Notifications,Push Notification,我已经使用C2dm实现了PushNotification。我也收到c2dm的通知。我的问题是,当我收到多个通知时,我想给出一个计数器,我的意思是“你有一个通知(计数)”。如何实现这一点。您在寻找什么?您可以将数字值设置到通知对象中 Notification notifyDetails = new Notification(R.drawable.alarm,intent.getExtras().getString(KEY_TITLE),System.currentTimeMillis()); no

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

您在寻找什么?

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

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 
这里是链接

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

notification.setNumber(1);

我指的是
通知
类中名为
编号
的公众成员,我也链接到了这个类。谢谢你,伙计,我会尝试一下这只是一个澄清,因为我花了一点时间才找到正确的方法。您需要更改此项,然后回拨NotificationManager。notify的ID与以前的通知相同。虽然这可能是答案,但最好包括代码如何以及为什么有助于解决问题中所述的问题。感谢您再次更正。我真的非常感激你们如何编辑我的帖子。这是因为您的声誉,或者您是编辑。请查看此编辑页面以了解更多信息:
NotificationManager notificationManager=(NotificationManager)context.getSystemService(NOTIFICATION_SERVICE);
notification.setNumber(1);