NotificationManager.UpdateAutomaticZenRule(String, AutomaticZenRule) Method

Definition

Updates the given zen rule.

[Android.Runtime.Register("updateAutomaticZenRule", "(Ljava/lang/String;Landroid/app/AutomaticZenRule;)Z", "GetUpdateAutomaticZenRule_Ljava_lang_String_Landroid_app_AutomaticZenRule_Handler", ApiSince=24)]
public virtual bool UpdateAutomaticZenRule(string? id, Android.App.AutomaticZenRule? automaticZenRule);
[<Android.Runtime.Register("updateAutomaticZenRule", "(Ljava/lang/String;Landroid/app/AutomaticZenRule;)Z", "GetUpdateAutomaticZenRule_Ljava_lang_String_Landroid_app_AutomaticZenRule_Handler", ApiSince=24)>]
abstract member UpdateAutomaticZenRule : string * Android.App.AutomaticZenRule -> bool
override this.UpdateAutomaticZenRule : string * Android.App.AutomaticZenRule -> bool

Parameters

id
String

String: The id of the rule to update

automaticZenRule
AutomaticZenRule

AutomaticZenRule: the rule to update.

Returns

Whether the rule was successfully updated.

Attributes

Remarks

Updates the given zen rule. Before Build.VERSION_CODES.VANILLA_ICE_CREAM, updating a rule that is not backed up by a ConditionProviderService will deactivate it if it was previously active. Starting with Build.VERSION_CODES.VANILLA_ICE_CREAM, this will only happen if the rule's definition is actually changing. Throws a SecurityException if policy access is not granted to this package. See isNotificationPolicyAccessGranted(). Callers can only update rules that they own. See AutomaticZenRule.getOwner.

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-08-03 UTC.

Android reference for android.app.NotificationManager.updateAutomaticZenRule.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to