How can i c开发者_如何转开发heck from my android application whether there is a keyguard enabled right now? I mean normally when screen goes off Android enables the keyguard, so next time you wake up you have keyguard screen infront of you. So I just want to know from the application that if there is a key guard enabled or not.
I had a look on keyguardmanager.java but it does not have that API.
Get the KeyGuardManager
system service, and call inKeyguardRestrictedInputMode()
function.
See Documentation Here.
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
Log.v(TAG,""+keyguardManager.inKeyguardRestrictedInputMode());
I tested on my HTC G1, it works.
精彩评论