I have a broadcast receiver, which starts an intent service.
Intent service triggers notification.
If there are multiple notifications fired, then since the NOTIFICATION_ID is same it doesn't update.
Is there any way to know how many notifications have been fired ? So that I can update my notification accordingly.
I don't want to fire separate notification. I want to update the existing notification. All I need here to figure out is the number of notifications already fired while firing a notification. And that number should reset when user click on it.
In your notify method make below changes.
notificationManager.notify(getID(), notification);
The getId() method will provide unique id so that multiple notification will come at same time.
private final static AtomicInteger c = new AtomicInteger(3);
public static int getID() {
return c.incrementAndGet();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.