Udostępnij za pośrednictwem


DevicePolicyManager.HasGrantedPolicy(ComponentName, DeviceAdminUses) Method

Definition

Returns true if an administrator has been granted a particular device policy.

[Android.Runtime.Register("hasGrantedPolicy", "(Landroid/content/ComponentName;I)Z", "GetHasGrantedPolicy_Landroid_content_ComponentName_IHandler")]
public virtual bool HasGrantedPolicy (Android.Content.ComponentName admin, Android.App.Admin.DeviceAdminUses usesPolicy);
[<Android.Runtime.Register("hasGrantedPolicy", "(Landroid/content/ComponentName;I)Z", "GetHasGrantedPolicy_Landroid_content_ComponentName_IHandler")>]
abstract member HasGrantedPolicy : Android.Content.ComponentName * Android.App.Admin.DeviceAdminUses -> bool
override this.HasGrantedPolicy : Android.Content.ComponentName * Android.App.Admin.DeviceAdminUses -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Must be an active administrator, or an exception will be thrown.

usesPolicy
DeviceAdminUses

Which uses-policy to check, as defined in DeviceAdminInfo.

Returns

Attributes

Remarks

Returns true if an administrator has been granted a particular device policy. This can be used to check whether the administrator was activated under an earlier set of policies, but requires additional policies after an upgrade.

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