I know how to lock device using DevicePolicyManager..
boolean active = mDPM.isAdminActive(mDeviceAdminSample);
if (active) mDPM.lockNow();
but how to undo this(unlock a phone)?
I know how to lock device using DevicePolicyManager..
boolean active = mDPM.isAdminActive(mDeviceAdminSample);
if (active) mDPM.lockNow();
but how to undo this(unlock a phone)?
Try this
KeyguardManager mKeyGuardManager = (KeyguardManager) DetSystemService(KEYGUARD_SERVICE);
KeyguardManager.KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("MainActivity");
mLock.disableKeyguard();
http://developer.android.com/tools/testing/activity_testing.html#UnlockDevice
However, I am not satisfy myself with this solution as it uses deprecated methods... hope that someone knows more...