Udostępnij za pośrednictwem


DevicePolicyManager.SetDelegatedScopes Method

Definition

Called by a profile owner or device owner to grant access to privileged APIs to another app.

[Android.Runtime.Register("setDelegatedScopes", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/util/List;)V", "GetSetDelegatedScopes_Landroid_content_ComponentName_Ljava_lang_String_Ljava_util_List_Handler", ApiSince=26)]
public virtual void SetDelegatedScopes (Android.Content.ComponentName admin, string delegatePackage, System.Collections.Generic.IList<string> scopes);
[<Android.Runtime.Register("setDelegatedScopes", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/util/List;)V", "GetSetDelegatedScopes_Landroid_content_ComponentName_Ljava_lang_String_Ljava_util_List_Handler", ApiSince=26)>]
abstract member SetDelegatedScopes : Android.Content.ComponentName * string * System.Collections.Generic.IList<string> -> unit
override this.SetDelegatedScopes : Android.Content.ComponentName * string * System.Collections.Generic.IList<string> -> unit

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

delegatePackage
String

The package name of the app which will be given access.

scopes
IList<String>

The groups of privileged APIs whose access should be granted to delegatedPackage.

Attributes

Remarks

Called by a profile owner or device owner to grant access to privileged APIs to another app. Granted APIs are determined by scopes, which is a list of the DELEGATION_* constants.

A broadcast with the #ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED action will be sent to the delegatePackage with its new scopes in an ArrayList<String> extra under the #EXTRA_DELEGATION_SCOPES key. The broadcast is sent with the Intent#FLAG_RECEIVER_REGISTERED_ONLY flag.

Delegated scopes are a per-user state. The delegated access is persistent until it is later cleared by calling this method with an empty scopes list or uninstalling the delegatePackage.

Java documentation for android.app.admin.DevicePolicyManager.setDelegatedScopes(android.content.ComponentName, java.lang.String, java.util.List<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