开发者

disablekeyguard() not working properly when receiver of SCREEN_ON is triggered in Android 2.2?

I am trying to disable the keyguard when SCREEN_ON is trigged. The following code is in a service run by the broadcast receiver of ACTION_SCREEN_ON: KeyguardManager myKeyGuard = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE); myLock = myKeyGuard.newKeyguardLock(); myLock.disableKeyguard(); startActivity("xxx");

This seems to work, but there is a problem. After the screen is on and my activity is displayed bypassing the keyguard, if the user presses the home button, the lockscreen is displayed, and if the user unlocks the screen, the next time the screen switches on, the keyguard is n开发者_运维百科ot disabled. I have to manually unlock the phone, and the activity is indeed running behind the lockscreen. So only the disablekeyguard() seems to stop working.

Any help with be appreciated:)


Apparently there is ambiguity in how the Home key events handled by Android. The OP of a post here seems to be facing the same problem. No answers to his query yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜