AppManagerEnableNotificationChannels Method |
public virtual int EnableNotificationChannels (string packageName, string notificationChannels, bool enabled);
Type: System.Int32
int AppManagerException.SUCCESS if successful, or an error code matching one of the AppManagerException constants.
| Exception | Condition |
|---|---|
| AppManagerException | if an error occurs and exceptions are enabled through the ErrorManager singleton. |
The NotificationChannel is identified using its Android identifier.
Regular expressions can be used to enable or disable multiple notification channels and/or applications in a single call:
"^(?:[\\w ]*)$"."^[a-zA-Z_][\\w]*(\\.[a-zA-Z_][\\w]*)*$".Examples:
AppManager appManager = new AppManager(this);
int result = appManager.enableNotificationChannels("com.google.android.deskclock", "^(?:[\\w ]*)$", false);
AppManager appManager = new AppManager(this);
int result = appManager.enableNotificationChannels("com.google.android.deskclock", "^(?:Bedtime|Timers|Firing|Missed Alarms)$", false);
AppManager appManager = new AppManager(this);
List channels = new ArrayListinvalid input: '<'>();
int result = appManager.getNotificationChannels("com.google.android.deskclock", channels);
for (NotificationChannel channel : channels) {
Log.d(TAG, "channel=" + channel.getId());
}
AppManager appManager = new AppManager(this);
int result = appManager.enableNotificationChannels("^[a-zA-Z_][\\w]*(\\.[a-zA-Z_][\\w]*)*$", "^(?:[\\w ]*)$", false);