Share via


DevicePolicyManager.GetPermissionGrantState Method

Definition

Returns the current grant state of a runtime permission for a specific application.

[Android.Runtime.Register("getPermissionGrantState", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)I", "GetGetPermissionGrantState_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=23)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_RUNTIME_PERMISSIONS")]
public virtual Android.App.Admin.PermissionGrantState GetPermissionGrantState (Android.Content.ComponentName? admin, string packageName, string permission);
[<Android.Runtime.Register("getPermissionGrantState", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)I", "GetGetPermissionGrantState_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=23)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_RUNTIME_PERMISSIONS")>]
abstract member GetPermissionGrantState : Android.Content.ComponentName * string * string -> Android.App.Admin.PermissionGrantState
override this.GetPermissionGrantState : Android.Content.ComponentName * string * string -> Android.App.Admin.PermissionGrantState

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin.

packageName
String

The application to check the grant state for.

permission
String

The permission to check for.

Returns

the current grant state specified by device policy. If admins have not set a grant has not set a grant state, the return value is #PERMISSION_GRANT_STATE_DEFAULT. This does not indicate whether or not the permission is currently granted for the package. <p/> If a grant state was set by the profile or device owner, then the return value will be one of #PERMISSION_GRANT_STATE_DENIED or #PERMISSION_GRANT_STATE_GRANTED, which indicates if the permission is currently denied or granted.

Attributes

Remarks

Returns the current grant state of a runtime permission for a specific application. This function can be called by a device owner, profile owner, or by a delegate given the #DELEGATION_PERMISSION_GRANT scope via #setDelegatedScopes.

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