Language

DevicePolicyManager.GetPolicy Method

Definition

Gets the value of the given policy, as it was set by the caller.

[Android.Runtime.Register("getPolicy", "(Landroid/app/admin/PolicyIdentifier;I)Ljava/lang/Object;", "GetGetPolicy_Landroid_app_admin_PolicyIdentifier_IHandler", ApiSince=37)]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public virtual Java.Lang.Object? GetPolicy(Android.App.Admin.PolicyIdentifier id, Android.App.Admin.DevicePolicyManagerScope scope);
[<Android.Runtime.Register("getPolicy", "(Landroid/app/admin/PolicyIdentifier;I)Ljava/lang/Object;", "GetGetPolicy_Landroid_app_admin_PolicyIdentifier_IHandler", ApiSince=37)>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
abstract member GetPolicy : Android.App.Admin.PolicyIdentifier * Android.App.Admin.DevicePolicyManagerScope -> Java.Lang.Object
override this.GetPolicy : Android.App.Admin.PolicyIdentifier * Android.App.Admin.DevicePolicyManagerScope -> Java.Lang.Object

Parameters

id
PolicyIdentifier

The identifier of the policy to get.

scope
DevicePolicyManagerScope

The scope with which the policy was set.

Returns

The value of the policy, or null if the caller didn't set the policy for the given scope.

Attributes

Remarks

Gets the value of the given policy, as it was set by the caller.

Use getResolvedDeviceWidePolicy(PolicyIdentifier) and getResolvedPerUserPolicy(PolicyIdentifier) to get the resolved policy value used on the device. Instead, this returns the value set by the caller.

Android reference for android.app.admin.DevicePolicyManager.getPolicy.

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