1

As a app designer, the worst thing is having my app unstalled. Second-worst is having my notifications blocked. If many users are blocking our app's notifications, I want to know early and often.

Seems like apps can know if they're blocked (NotificationListener?), but it's not clear how to measure percentage of users blocking my app. I was surprised to find no existing API in Google Analytics or Android's APIs for this.

When I can't find an API for something I presume is really important, it makes me worry there's some other way to get that info that I don't know about. Is there?

joshoff
  • 31
  • 7

2 Answers2

3

You can use the NotificationManagerCompat.areNotificationsEnabled() method to determine if your notifications are blocked.

Keep in mind that this only will return false on Kitkat or above devices - prior to that, it was not possible to determine if you blocked (even though blocking notifications was added in Jellybean MR2).

Of course, as detailed in the What's new with Notifications I/O 2016 talk, this should only be used for catching edge cases (like on a notification settings page) and not for telling the user that they must re-enable notifications.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
0

You can check this setting via reflection: how to programmatically check if the app's "Show Notification" is on/off as set in "Settings"

Community
  • 1
  • 1
nicobatu
  • 1,377
  • 3
  • 15
  • 34