开发者

check if keyguard is enabled i.e. currently active from android application

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜