See Also: DeviceAdminReceiver Members
Base class for implementing a device administration component. This class provides a convenience for interpreting the raw intent actions that are sent by the system.
The callback methods, like the base Android.Content.BroadcastReceiver.OnReceive(Android.Content.Context, Android.Content.Intent) method, happen on the main thread of the process. Thus long running operations must be done on another thread. Note that because a receiver is done once returning from its receive function, such long-running operations should probably be done in a Android.App.Service.
xml Example
<receiver android:name=".app.DeviceAdminSample$DeviceAdminSampleReceiver"
android:label="@string/sample_device_admin"
android:description="@string/sample_device_admin_description"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data android:name="android.app.device_admin"
android:resource="@xml/device_admin_sample" />
<intent-filter>
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
</receiver>xml Example
<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
<uses-policies>
<limit-password />
<watch-login />
<reset-password />
<force-lock />
<wipe-data />
<expire-password />
<encrypted-storage />
<disable-camera />
<disable-keyguard-features />
</uses-policies>
</device-admin>When publishing your DeviceAdmin subclass as a receiver, it must handle DeviceAdminReceiver.ActionDeviceAdminEnabled and require the NoType:android/Manifest$permission;Href=../../../../reference/android/Manifest.permission.html#BIND_DEVICE_ADMIN permission. A typical manifest entry would look like:
The meta-data referenced here provides addition information specific to the device administrator, as parsed by the Android.App.Admin.DeviceAdminInfo class. A typical file would be:
For more information about device administration, read the Device Administration developer guide.