如何使用DevicePolicyManager解锁手机

时间:2013-07-30 11:51:49

标签: android device-admin

我知道如何使用DevicePolicyManager锁定设备..

boolean active = mDPM.isAdminActive(mDeviceAdminSample);
            if (active) mDPM.lockNow();

但如何解除此问题(解锁手机)?

1 个答案:

答案 0 :(得分:-1)

试试这个

KeyguardManager mKeyGuardManager = (KeyguardManager) DetSystemService(KEYGUARD_SERVICE);
                KeyguardManager.KeyguardLock mLock = mKeyGuardManager.newKeyguardLock("MainActivity");
                mLock.disableKeyguard();

http://developer.android.com/tools/testing/activity_testing.html#UnlockDevice

然而,我不满足于这个解决方案,因为它使用了弃用的方法...希望有人知道更多......