Skip to content Skip to sidebar Skip to footer

Multiple Notifications Not Showing In Android

In my android app I'm willing to show multiple notifications on a particular day,for this I'm using Alarm Manager and Broadcast Receiver problem is when I used alarm it worked fine

Solution 1:

You need to pass different notification id for each Notification . If you pass same id (i.e., 0 in your case), the existed notification will be updated with the new data. change the notification id: eg have a variable and increment it. notificationid++

Solution 2:

I had a similar issue, I was creating multiple notifications with different IDs, however, when I clicked on one, only the first one opened the specific scree, all the sequential notifications were ignore (clicking on them didn't do anything, they were just dismissed). Then I tried to do this:

intent.setAction(context.getPackageName() + "." + notificationId);

Which means that each unique notification also carries its own unique Intent and in this case the Intents weren't ignored and each of them opened the needed screen. I must note that my Intents were the same (e.g. NoteDetails.class), so I guess I had to separate them somehow...i'm glad it worked anyways.

Solution 3:

Box's answer was a nudge in the right direction for me.

I just had to change the requestCode in the PendingIntent I was passing to the AlarmManager, so it wasn't the same value.

Old code:

PendingIntentpI= PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);

New code:

PendingIntentpI= PendingIntent.getBroadcast(context, notificationId, intent, PendingIntent.FLAG_UPDATE_CURRENT);

Post a Comment for "Multiple Notifications Not Showing In Android"