I am using following code to get notifications from a service
nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Intent intent = new Intent(this,test.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, intent,Notification.FLAG_AUTO_CANCEL);
String body = "Hi this is test"+count;
String title = "Ritu"+count;
Notification n = new Notification(R.drawable.icon,body,System.currentTimeMillis());
n.setLatestEventInfo(this, title, body, pi);
n.defaults = Notification.DEFAULT_LIGHTS;
n.number=++count;
nm.notify(uniqueid, n);
Every time I am getting a new notification, the number on it gets incremented but when I open notification window I can see only one the latest notification and after clicking on it number of notification does not get decremented.
Where I am wrong please help.
Thanks!
Try this, in order to remove notification after click:
And instead of using:
Use:
This will allow you to have multiple notifications at the same time