android - 有什么方法可以从我的 Android 应用程序中找出 Activity 通知的数量?

标签 android notifications android-notifications

我正在努力管理我的应用在 Android 设备中创建的通知。是否有任何方法可以在任何给定时间向我提供来 self 的应用的 Activity (即仍然在通知抽屉中可见)的通知数量

最佳答案

您可以使用 NotificationManager使用 getActiveNotifications() 获取您的应用程序发布的所有 Activity 通知的列表

根据 getActiveNotifications() 的引用文档:

Recover a list of active notifications: ones that have been posted by the calling app that have not yet been dismissed by the user or cancelled by the app.

关于android - 有什么方法可以从我的 Android 应用程序中找出 Activity 通知的数量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30006704/

相关文章:

xcode - Flutter 本地通知 iOS 不起作用

android - 使用 NotificationCompat.MediaStyle 和 MediaSessionCompat 从通知中控制我的网络广播播放器

android - android 计算 session 长度

android - ImageSwitcher 中的 setImageDrawable 和 setImageResource 时出现 NullPointerException

android - Android模拟器没有声音

java - 在 CancelAll 之后删除队列中剩余的请求

notifications - APNs 的设备 token 是什么编码?

android - 如何配置我的 Phonegap 应用程序以根据手机的分辨率相应地缩放其视口(viewport)?

javascript - Vaadin:通过 "close"、 "ok"或 "x"关闭通知?

java - 打开通知后 fragment 不会更新