Partager via


UserManager.SetUserRestriction(String, Boolean) Method

Definition

Caution

deprecated

Sets the value of a specific restriction on the context user.

[Android.Runtime.Register("setUserRestriction", "(Ljava/lang/String;Z)V", "GetSetUserRestriction_Ljava_lang_String_ZHandler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_USERS")]
[System.Obsolete("deprecated")]
public virtual void SetUserRestriction (string? key, bool value);
[<Android.Runtime.Register("setUserRestriction", "(Ljava/lang/String;Z)V", "GetSetUserRestriction_Ljava_lang_String_ZHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_USERS")>]
[<System.Obsolete("deprecated")>]
abstract member SetUserRestriction : string * bool -> unit
override this.SetUserRestriction : string * bool -> unit

Parameters

key
String

the key of the restriction

value
Boolean

the value for the restriction

Attributes

Remarks

Sets the value of a specific restriction on the context user. Requires the MANAGE_USERS permission.

This member is deprecated. use android.app.admin.DevicePolicyManager#addUserRestriction( android.content.ComponentName, String) or android.app.admin.DevicePolicyManager#clearUserRestriction( android.content.ComponentName, String) instead.

Java documentation for android.os.UserManager.setUserRestriction(java.lang.String, boolean).

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