How can I know programmatically if a notification channel is enabled on Android O?

jmart

Looking at the docs I can see methods for checking all the attributes of a notification channel, but I couldn't find a way to check if the channel itself is enabled or disabled.

Am I missing something?

Darush

The Official Documentation has your answer:

You can call the following two methods to discover the settings a user has applied to a notification channel:

  • o retrieve a single notification channel, you can call getNotificationChannel().
  • To retrieve all notification channels belonging to your app, you can call getNotificationChannels().

After you have the NotificationChannel, you can use methods such as getVibrationPattern() and getSound() to find out what settings the user currently has. To find out if a user blocked a notification channel, you can call getImportance(). If the notification channel is blocked, getImportance() returns IMPORTANCE_NONE.

So getImportance() will tell you if notification channel is blocked or not.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I turn ON/OFF "Show notification" programmatically in android

How can I know the application state of an Android App to display or not a notification?

Can't update sound programmatically for Notification Channel on Android Oreo

How can I know if IP Multicast is enabled

How can I create a notification channel for Android API level < 26 (before Android Oreo)?

How can I check if a specific type of local notification is enabled?

How can i check lock screen notifcation is enabled or not programmatically

On Linux: how can I programmatically determine if a NIC interface is enabled and plugged in?

Android O: Notification Channel localization

How can I unlock screen programmatically when the notification action is clicked from lock screen in Android?

How can I know if a SwiftUI Button is enabled/disabled?

How can i send a welcome message with DiscordPy to the standard notification channel?

How can I know which button clicked on it inside notification?

How can I know which button was clicked in the notification?

How do I programmatically play the Android NFC notification sound?

android check if "Allow sound" notification setting is enabled programmatically

How can I display a warning information "missed call" in notification bar when I hang up a call programmatically in android?

How can I add focus programmatically in Android?

How can I programmatically include layout in Android?

How can I lock an icon in Android (programmatically)?

How can I programmatically cause a delay in Android?

How Can I Do Android Numpad Programmatically

Android O reporting notification not posted to channel - but it is

How can I know if an achievement is completed in android?

How can I receive a notification/event when mediaStreamTrack.enabled is modified?

Android 4.3 : How can I check if user has lock enabled?

How to increase the ringer & notification volume programmatically in android

How to stop playing notification sound programmatically on Android

How can I know the number of subscribers of a channel with the youtube API using php?