i am try to lock the device using DeviceAdminReceiver and try to enable administration like following:
if (!mDPM.isAdminActive(mDeviceAdminSample)) {
Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN)
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, mDeviceAdminSample);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "Additional text explaining why this needs to be added."); startActivity(intent);
}
and getting error something like the following:
ERROR/Error(1022): java.lang.SecurityException: No active admin owned by uid 10045 for policy #3
kindly give me some code solutions and how to enable the administration permission.