Des*_*tor 6 notifications android
这个问题似乎很熟悉,是的,我一直在寻找解决方案,但是答案不适合我的用例。
我想访问所有活动的通知并在发布新通知之前使用该信息。我知道我们可以使用NotificationListenerService(https://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications())
来获取AllActiveNotifications,但这将在通知发布回调为被接收者接收。我基本上想在发布新通知之前检查所有活动通知,以免再发布具有相同内容的通知。
为了发布,我使用NotificationManager,如下所示:
NotificationManager nm = mContext.getSystemService(mContext.NOTIFICATION_SERVICE);
nm.notify(tag, id, notification);
我不想将通知ID存储在数据库中,并在发布任何新通知时使用它。
我在这里先向您的帮助表示感谢!
更新:
似乎可以通过API23实现:
https : //developer.android.com/reference/android/app/NotificationManager.html#getActiveNotifications()
但是我想知道是否有任何方法可以在21或更低版本中实现。
| 归档时间: |
|
| 查看次数: |
6693 次 |
| 最近记录: |