I have an application in which the user can create events and set notifications for this event itself. So I want to add some notifications. 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 create a notification using the above code, it works fine. But if I add another event, a new notification will not be created, the old one will only be updated. I want to add another notification. How to do it? Moreover, I want to delete any specific notification if the user deletes the corresponding event. How is this possible?
dev_android
source share