android-notifications - 如何访问 Android(电视)上的推送通知计数器?

标签 android-notifications android-tv android-notification-bar android-push-notification

我想访问以下当前可用推送通知的数量:example has '1' push notification ,这里是 Android TV 模拟器图像..

那么我怎样才能读取那个数字呢?

编辑:我不想设置任何东西。

最佳答案

您可以使用 NotificationListenerService 来管理与通知相关的所有内容。您还可以扩展它并覆盖 onNotificationPosted 等方法来维护您自己的计数器。或者更好的是,直接使用 getActiveNotifications()

在此处查看文档 https://developer.android.com/reference/android/service/notification/NotificationListenerService#getActiveNotifications()

您需要授予您的应用访问通知的权限才能使其正常工作。

关于android-notifications - 如何访问 Android(电视)上的推送通知计数器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66268487/

相关文章:

Android 26 (O) 通知不显示操作图标

Android 通知 FLAG_AUTO_CANCEL 不工作且不显示新 Activity

Android Studio 无线 ADB 错误 (10061)(电视)

java - Android:通知栏中未显示通知

android - 通知抽屉打开后无法继续播放通知声音

android - 除非断点,否则通知不会更新

android - 对 Android TV 应用与其他设备的兼容性感到困惑

authentication - 为什么 TV App 通常需要通过网址输入激活码?

java - 单击通知时如何打开 Activity