Is there any callback my application receives when user blocks a Notification Channel created by my application OR it can be detected later ?
Asked
Active
Viewed 1,662 times
2 Answers
6
Starting from Android P, there is a system broadcast for this: https://developer.android.com/reference/android/app/NotificationManager.html#ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED
It's impossible to reliably sync our backend push servers with the channel settings without this (you have to poll...)
![](../../users/profiles/986216.webp)
riwnodennyk
- 7,312
- 4
- 31
- 36
![](../../users/profiles/1664556.webp)
rockgecko
- 3,906
- 2
- 15
- 26
1
No, there is no such listener provided by the APIs. You will have to check each time before you make a notification.
From the developer document
To find out if a user blocked a notification channel, you can call getImportance(). If the notification channel is blocked, getImportance() returns IMPORTANCE_NONE.
![](../../users/profiles/4620609.webp)
Samuel Robert
- 7,119
- 7
- 34
- 52