10

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.

Destructor
  • 3,154
  • 7
  • 32
  • 51
  • 4
    Possible duplicate of [How to check which notifications are active in status bar in Android Dev?](http://stackoverflow.com/questions/3630733/how-to-check-which-notifications-are-active-in-status-bar-in-android-dev) – Yoav Feuerstein Jan 30 '17 at 12:21

0 Answers0