Compartilhar via


DevicePolicyManager.SetApplicationRestrictionsManagingPackage Method

Definition

Called by a profile owner or device owner to grant permission to a package to manage application restrictions for the calling user via #setApplicationRestrictions and #getApplicationRestrictions.

[Android.Runtime.Register("setApplicationRestrictionsManagingPackage", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetSetApplicationRestrictionsManagingPackage_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=24)]
public virtual void SetApplicationRestrictionsManagingPackage (Android.Content.ComponentName admin, string? packageName);
[<Android.Runtime.Register("setApplicationRestrictionsManagingPackage", "(Landroid/content/ComponentName;Ljava/lang/String;)V", "GetSetApplicationRestrictionsManagingPackage_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=24)>]
abstract member SetApplicationRestrictionsManagingPackage : Android.Content.ComponentName * string -> unit
override this.SetApplicationRestrictionsManagingPackage : Android.Content.ComponentName * string -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

packageName
String

The package name which will be given access to application restrictions APIs. If null is given the current package will be cleared.

Attributes

Remarks

Called by a profile owner or device owner to grant permission to a package to manage application restrictions for the calling user via #setApplicationRestrictions and #getApplicationRestrictions.

This permission is persistent until it is later cleared by calling this method with a null value or uninstalling the managing package.

The supplied application restriction managing package must be installed when calling this API, otherwise an NameNotFoundException will be thrown.

This member is deprecated. From android.os.Build.VERSION_CODES#O. Use #setDelegatedScopes with the #DELEGATION_APP_RESTRICTIONS scope instead.

Java documentation for android.app.admin.DevicePolicyManager.setApplicationRestrictionsManagingPackage(android.content.ComponentName, java.lang.String).

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