Udostępnij za pośrednictwem


DeviceAdminReceiver.OnEnabled(Context, Intent) Method

Definition

Called after the administrator is first enabled, as a result of receiving #ACTION_DEVICE_ADMIN_ENABLED.

[Android.Runtime.Register("onEnabled", "(Landroid/content/Context;Landroid/content/Intent;)V", "GetOnEnabled_Landroid_content_Context_Landroid_content_Intent_Handler")]
public virtual void OnEnabled (Android.Content.Context context, Android.Content.Intent intent);
[<Android.Runtime.Register("onEnabled", "(Landroid/content/Context;Landroid/content/Intent;)V", "GetOnEnabled_Landroid_content_Context_Landroid_content_Intent_Handler")>]
abstract member OnEnabled : Android.Content.Context * Android.Content.Intent -> unit
override this.OnEnabled : Android.Content.Context * Android.Content.Intent -> unit

Parameters

context
Context

The running context as per #onReceive.

intent
Intent

The received intent as per #onReceive.

Attributes

Remarks

Called after the administrator is first enabled, as a result of receiving #ACTION_DEVICE_ADMIN_ENABLED. At this point you can use DevicePolicyManager to set your desired policies.

If the admin is activated by a device owner, then the intent may contain private extras that are relevant to user setup. DevicePolicyManager#createAndManageUser(ComponentName, String, ComponentName, PersistableBundle, int)

Java documentation for android.app.admin.DeviceAdminReceiver.onEnabled(android.content.Context, android.content.Intent).

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