4

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)?

Atul Bhardwaj
  • 6,647
  • 5
  • 45
  • 63

1 Answers1

-1

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...

Ben
  • 69
  • 8