I have developing an App where the user can create event and set notification for that very event. So I want to add multiple notification. I am using the following code.
final Notification notifyDetails = new Notification(R.drawable.icon, "Myapp",calendar.getTimeInMillis());
Context context = getApplicationContext();
Intent notifyIntent = new Intent(context, ViewDoughnut.class);
PendingIntent pendingIntent = PendingIntent.getActivity(ViewCal.this, 0, notifyIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle, contentText, pendingIntent);
notifyDetails.flags = Notification.FLAG_ONGOING_EVENT;
mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails);
When I add an event and creating a notification using the above code, it is working fine. But if I add another event, no new notification created, the old one is just updated. I want to add one more notification. How to do it? Moreover, I want to delete any specific notification if the user delete the event corresponding to it. How it is possible?
I assume that SIMPLE_NOTIFICATION_ID
is a constant? To have separate notifications you need to use a different ID for each one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With