Dsiplay Multiple Notifications in status bar

For showing multiple notifications use unique identifier while creating notification which means use unique id in notify() method.

eg: notificationManager.notify(tag, id, notification);

Here, id should be unique.

Also, in PendingIntent "REQUEST_CODE" should be unique. use the same code as notificationId.

PendingIntent pIntent = PendingIntent.getService(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Here also, id should be unique, use the same id itself. When clicking on notification, if you want to launch some component, to "intent" pass the desired arguments. For cancel, use both tag and id in the activity or service to cancel. First pass the tag and id to the service and then cancel using BOTH. This is very important


Popular posts from this blog

AlarmManager and Notification in Android

Swipe Action and ViewFlipper in Android