1
我在android中開發了Notification應用程序。但它沒有顯示通知的數量。通知計數在android中
這裏是我的代碼:
int notificationCount = 0;
private NotificationManager mgr=null;
mgr=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification note=new Notification(R.drawable.chatpingicon, message+" says...",System.currentTimeMillis());
PendingIntent i = PendingIntent.getActivity(this, -1, new Intent(this, HomeActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
Intent notifyIntent = new Intent(this, MyActivity.class);
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
note.number = notificationCount++;
noti.defaults = Notification.DEFAULT_ALL;
noti.flags|=Notification.FLAG_AUTO_CANCEL;
mgr.notify(NOTIFY_ME_ID++, noti);