Partager via


PolicyUpdateReceiver.OnPolicySetResult Method

Definition

Callback triggered after an admin has set a policy using one of the APIs in DevicePolicyManager to notify the admin whether it has been successful or not.

[Android.Runtime.Register("onPolicySetResult", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/admin/TargetUser;Landroid/app/admin/PolicyUpdateResult;)V", "GetOnPolicySetResult_Landroid_content_Context_Ljava_lang_String_Landroid_os_Bundle_Landroid_app_admin_TargetUser_Landroid_app_admin_PolicyUpdateResult_Handler", ApiSince=34)]
public virtual void OnPolicySetResult (Android.Content.Context context, string policyIdentifier, Android.OS.Bundle additionalPolicyParams, Android.App.Admin.TargetUser targetUser, Android.App.Admin.PolicyUpdateResult policyUpdateResult);
[<Android.Runtime.Register("onPolicySetResult", "(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/admin/TargetUser;Landroid/app/admin/PolicyUpdateResult;)V", "GetOnPolicySetResult_Landroid_content_Context_Ljava_lang_String_Landroid_os_Bundle_Landroid_app_admin_TargetUser_Landroid_app_admin_PolicyUpdateResult_Handler", ApiSince=34)>]
abstract member OnPolicySetResult : Android.Content.Context * string * Android.OS.Bundle * Android.App.Admin.TargetUser * Android.App.Admin.PolicyUpdateResult -> unit
override this.OnPolicySetResult : Android.Content.Context * string * Android.OS.Bundle * Android.App.Admin.TargetUser * Android.App.Admin.PolicyUpdateResult -> unit

Parameters

context
Context

the running context as per #onReceive

policyIdentifier
String

Key to identify which policy this callback relates to.

additionalPolicyParams
Bundle

Bundle containing additional params that may be required to identify some of the policy (e.g. PolicyUpdateReceiver#EXTRA_PACKAGE_NAME and PolicyUpdateReceiver#EXTRA_PERMISSION_NAME). Each policy will document the required additional params if needed.

targetUser
TargetUser

The TargetUser which this policy relates to.

policyUpdateResult
PolicyUpdateResult

Indicates whether the policy has been set successfully (PolicyUpdateResult#RESULT_POLICY_SET) or the reason it failed to apply (e.g. PolicyUpdateResult#RESULT_FAILURE_CONFLICTING_ADMIN_POLICY, etc).

Attributes

Remarks

Callback triggered after an admin has set a policy using one of the APIs in DevicePolicyManager to notify the admin whether it has been successful or not.

Admins wishing to receive this callback should include PolicyUpdateReceiver#ACTION_DEVICE_POLICY_SET_RESULT in the intent filter for their receiver in the manifest, the receiver must be protected by android.Manifest.permission#BIND_DEVICE_ADMIN to ensure that only the system can send updates.

Java documentation for android.app.admin.PolicyUpdateReceiver.onPolicySetResult(android.content.Context, java.lang.String, android.os.Bundle, android.app.admin.TargetUser, android.app.admin.PolicyUpdateResult).

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