看看这里的答案:
How to give counter if more than one Notifications are there
Notification notification = new Notification(R.drawable.direction, "Cool Notification",
System.currentTimeMillis());
/********LIKE THIS*********/
notification.number = notificationCount++;
/********LIKE THIS*********/
notification.setLatestEventInfo(context, "Cool Notification Title",
"updated notificaiton message", null);
NotificationManager nm = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
nm.notify(R.id.my_motification, notification);
您必须通过NotificationManager.notify方法发送您的通知,所有这些方法具有相同的id.如文档所述,id是您应用程序中该通知的唯一标识符.如果您重复使用相同的ID,它将只更新该通知的文本和数字.
要查看用户何时点击通知,您需要提供一个PendingIntent(请参阅tutorial).要检查用户何时清除通知,您需要使用仅在Api级别11中可用的Notification.Builder.