Hi I have created an Notification class from which I can create multiple notification like this:
int id=0;
id++;
notification = new NotificationCompat.Builder(this)
.setContentTitle(title)
.setSmallIcon(icon)
.setContentText(dataNotes)
.setWhen(time)
.setAutoCancel(false)
.setOngoing(true)
.addAction(action)
.setStyle(new NotificationCompat.BigTextStyle().bigText(dataNotes))
.build();
nm.notify(id,notification);
So, my question is how can I get id of each notification that i create.I want to use that id when i want to cancel a particular notification.
I know StatusBarNotification
contains getId()
method to get id but i don't know how to implement it.Can anyone help me.