如果存在多个通知,如何提供计数器

Aju*_*Aju 5 notifications android push-notification

我已经使用C2dm实现了PushNotification.我也收到来自c2dm的通知.我的问题是,当我收到多个通知时,我想给一个计数器,我的意思是"你有一个通知(计数)".我该如何实现呢.

Pra*_*tik 5

您可以将数值设置为Notification对象

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 
Run Code Online (Sandbox Code Playgroud)

链接在这里

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

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

Android通知栏号