How to detect a Notification Channel is blocked by user in Android 8.0
Asked Answered
P

2

7

Is there any callback my application receives when user blocks a Notification Channel created by my application OR it can be detected later ?

Piassava answered 19/9, 2017 at 7:29 Comment(0)
S
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.

Snob answered 19/9, 2017 at 7:42 Comment(0)
M
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...)

Meaning answered 12/3, 2018 at 5:8 Comment(1)
Is it possible to register to it via the manifest? Or only during runtime?Afterguard
S
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.

Snob answered 19/9, 2017 at 7:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.