共用方式為


UserManager.RequestQuietModeEnabled Method

Definition

Overloads

RequestQuietModeEnabled(Boolean, UserHandle)

Enables or disables quiet mode for a managed profile.

RequestQuietModeEnabled(Boolean, UserHandle, Int32)

Perform the same operation as #requestQuietModeEnabled(boolean, UserHandle), but with a flag to tweak the behavior of the request.

RequestQuietModeEnabled(Boolean, UserHandle)

Enables or disables quiet mode for a managed profile.

[Android.Runtime.Register("requestQuietModeEnabled", "(ZLandroid/os/UserHandle;)Z", "GetRequestQuietModeEnabled_ZLandroid_os_UserHandle_Handler", ApiSince=28)]
public virtual bool RequestQuietModeEnabled (bool enableQuietMode, Android.OS.UserHandle userHandle);
[<Android.Runtime.Register("requestQuietModeEnabled", "(ZLandroid/os/UserHandle;)Z", "GetRequestQuietModeEnabled_ZLandroid_os_UserHandle_Handler", ApiSince=28)>]
abstract member RequestQuietModeEnabled : bool * Android.OS.UserHandle -> bool
override this.RequestQuietModeEnabled : bool * Android.OS.UserHandle -> bool

Parameters

enableQuietMode
Boolean

whether quiet mode should be enabled or disabled

userHandle
UserHandle

user handle of the profile

Returns

false if user's credential is needed in order to turn off quiet mode, true otherwise

Attributes

Remarks

Enables or disables quiet mode for a managed profile. If quiet mode is enabled, apps in a managed profile don't run, generate notifications, or consume data or battery.

If a user's credential is needed to turn off quiet mode, a confirm credential screen will be shown to the user.

The change may not happen instantly, however apps can listen for Intent#ACTION_MANAGED_PROFILE_AVAILABLE and Intent#ACTION_MANAGED_PROFILE_UNAVAILABLE broadcasts in order to be notified of the change of the quiet mode. Apps can also check the current state of quiet mode by calling #isQuietModeEnabled(UserHandle).

The caller must either be the foreground default launcher or have one of these permissions: MANAGE_USERS or MODIFY_QUIET_MODE.

Java documentation for android.os.UserManager.requestQuietModeEnabled(boolean, android.os.UserHandle).

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

RequestQuietModeEnabled(Boolean, UserHandle, Int32)

Perform the same operation as #requestQuietModeEnabled(boolean, UserHandle), but with a flag to tweak the behavior of the request.

[Android.Runtime.Register("requestQuietModeEnabled", "(ZLandroid/os/UserHandle;I)Z", "GetRequestQuietModeEnabled_ZLandroid_os_UserHandle_IHandler", ApiSince=30)]
public virtual bool RequestQuietModeEnabled (bool enableQuietMode, Android.OS.UserHandle userHandle, int flags);
[<Android.Runtime.Register("requestQuietModeEnabled", "(ZLandroid/os/UserHandle;I)Z", "GetRequestQuietModeEnabled_ZLandroid_os_UserHandle_IHandler", ApiSince=30)>]
abstract member RequestQuietModeEnabled : bool * Android.OS.UserHandle * int -> bool
override this.RequestQuietModeEnabled : bool * Android.OS.UserHandle * int -> bool

Parameters

enableQuietMode
Boolean

whether quiet mode should be enabled or disabled

userHandle
UserHandle

user handle of the profile

flags
Int32

Can be 0 or #QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED.

Returns

false if user's credential is needed in order to turn off quiet mode, true otherwise

Attributes

Remarks

Perform the same operation as #requestQuietModeEnabled(boolean, UserHandle), but with a flag to tweak the behavior of the request.

Java documentation for android.os.UserManager.requestQuietModeEnabled(boolean, android.os.UserHandle, int).

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