android - Avoid SecurityException because of "No active admin owned by" -
how avoid exception
e/androidruntime(26113): caused by: java.lang.securityexception: no active admin owned uid xxxx policy #3 when calling this:
public static void lockscreen(context context) { log.d(tag, "lockscreen"); componentname mdeviceadminsample = null; devicepolicymanager dpm = (devicepolicymanager) context.getsystemservice(context.device_policy_service); intent intent = new intent(devicepolicymanager.action_add_device_admin); intent.putextra(devicepolicymanager.extra_device_admin, mdeviceadminsample); dpm.locknow(); }
you have install , enable device administrator described in reference docs: http://developer.android.com/guide/topics/admin/device-admin.html
Comments
Post a Comment