Hello I want to start/activate Device Admin when application start without using Intent. Now I am using this code:
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, Global.mDeviceAdminSample);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
"Additional text explaining why this needs to be added.");
startActivityForResult(intent, RESULT_ENABLE);
But I dont want to use Intent. I want to start Device Admin directly .
Can anyone know how can I do that?
Thanks.
Fortunately it's not possible without user interaction. User must confirm your app as device admin in settings so you can navigate user to the settings at best.
It would be a huge security risk if apps could activate device administrators without user interaction (device admin has pretty big privileges).