Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple notification on same intent
    primarykey
    data
    text
    <p>I am writing an application and in this application <strong>I need to set multiple notification with same intent</strong> just like open my application whenever user tap on any notification.</p> <p>All the notification comes on different time and date without having any data but the problem is, <strong>if I set two notification for 03:27 PM and 03:28 PM then the first notification (03:27 PM) is canceled (Overwritten by second) and second is working correctly</strong>.</p> <p>I am currently using this code for achieving this goal:</p> <p>this method is used to set notification from Activity: </p> <pre><code> public static void setNotificationOnDateTime(Context context, long fireTime) { int requestID = (int) System.currentTimeMillis(); AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(context, NotificationReceiver.class); PendingIntent pi = PendingIntent.getBroadcast(context, requestID, i, 0); am.set(AlarmManager.RTC_WAKEUP, fireTime, pi); } </code></pre> <p>and my NotificationReceiver class look like this:</p> <pre><code> NotificationManager nm; @Override public void onReceive(Context context, Intent intent) { Log.w("TAG", "Notification fired..."); nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent contentIntent; Bundle bundle = intent.getExtras().getBundle("NotificationBundle"); if(bundle == null) { contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, SplashScreen.class), 0); } else { contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, MenuScreen.class) .putExtra("NotificationBundle", bundle), 0); } Notification notif = new Notification(R.drawable.ic_launcher, "Crazy About Android...", System.currentTimeMillis()); notif.setLatestEventInfo(context, "Me", "Message test", contentIntent); notif.flags |= Notification.FLAG_AUTO_CANCEL; nm.notify(1, notif); } </code></pre> <p>I alerady spend a lot time on googling and found some solutions but they didn't work for me here is the link of some of them:</p> <p><a href="https://stackoverflow.com/a/3009690/1250370">android pending intent notification problem</a></p> <p><a href="https://stackoverflow.com/q/6066363/1250370">Multiple notifications to the same activity</a></p> <p>If any one knows how to do this please help me.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload