The question seems familiar and yes I have looked around for the solution but answers are not suiting my use case.
I want to access all the active notifications and use the information before I publish a new notification. I am aware the we can getAllActiveNotifications using the NotificationListenerService (https://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications())
But this would help me get the notification after notification posted callback is received by receiver. I basically want to check for all active notifications before posting a new notification so that I don't post the notification with same content again.
In order to publish I am using the NotificationManageras follows:
NotificationManager nm = mContext.getSystemService(mContext.NOTIFICATION_SERVICE);
nm.notify(tag, id, notification);
I don't want to store the notification ID in database and use that while posting any new notifications.
Thanks for the help in advance!
Update:
It seems this is possible with API23:
https://developer.android.com/reference/android/app/NotificationManager.html#getActiveNotifications()
But I was wondering if there any way to achieve this in 21 or below.