android - Android 中是否有针对 "users blocking our notifications"的 API?

标签 android android-notifications

作为应用程序设计者,最糟糕的事情就是让我的应用程序停止运行。第二糟糕的是我的通知被屏蔽了。如果很多用户屏蔽了我们应用程序的通知,我想尽早并经常知道。

似乎应用程序可以知道它们是否被阻止(NotificationListener?),但不清楚如何衡量阻止我的应用程序的用户百分比。我很惊讶地发现 Google Analytics 或 Android 的 API 中没有现成的 API。

当我找不到我认为非常重要的东西的 API 时,我会担心是否有其他方法可以获取我不知道的信息。有吗?

最佳答案

您可以使用 NotificationManagerCompat.areNotificationsEnabled()确定您的通知是否被阻止的方法。

请记住,这只会在 Kitkat 或更高版本的设备上返回 false - 在此之前,无法确定您是否已阻止(即使在 Jellybean MR2 中添加了阻止通知)。

当然,详见What's new with Notifications I/O 2016 talk ,这应该只用于捕捉边缘情况(比如在通知设置页面上),而不是告诉用户他们必须重新启用通知。

关于android - Android 中是否有针对 "users blocking our notifications"的 API?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38234213/

相关文章:

android - 当应用程序在前台并调用 onMessageReceived 时不显示通知

java - 从通知导航到 Activity 时丢失 Activity 状态

java - Android NFC Intent 不是 "called"

android - Flutter如何将这个BLoC旧版本代码迁移到Bloc新版本

android - Android 中的 apk 签名与使用 keytool 的区别

android wear : only picture, 无标题第二页

android - 以编程方式取消(和隐藏)Android 通知

android - 单击后将通知从通知区域中删除

Android AlertDialog BUTTON_POSITIVE/BUTTON_NEGATIVE顺序

android - android中不调用隐式 Intent