0

我的应用需要移除 Android 设备的锁屏。它按照此处所述完成并且有效。

锁屏什么时候回来?例如,假设我在我的主要活动中编写这些代码行并且用户启动我的应用程序,直到锁定屏幕不会出现?

4

1 回答 1

0

Until a call to the reenableKeyguard() method of your KeyguardLock object.

KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard(); //keyguard disabled
//some code
lock.reenableKeyguard(); //keyguard reenabled

(Also I suppose a restart would re-enable it too. ;])

See: http://developer.android.com/reference/android/app/KeyguardManager.KeyguardLock.html#disableKeyguard()

于 2013-07-31T07:51:07.197 回答