I got these two in my Manifest.xml:
<android:permission="android.permission.BIND_DEVICE_ADMIN">
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
Meta-data:
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/device_owner_receiver"/>
And this in my MainActivity:
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mAdminName);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Click");
startActivityForResult(intent, REQUEST_CODE);
This works nicely, but in the Activity where the user should grant admin rights, the system lists a lot of things I don't want to do, like "Erase all data". Can I ask for only a subset of the admin rights, like "Lock Screen"?
Thanks.