开发者

Android:Unlock Screen

I am able to unlock the screen when there is an incoming call and after that lock the screen again. After a restart of the device if I get first incoming call this logic is not working. On subsequent incoming calls the logic works.

Any help??

My code is:

开发者_开发技巧
String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
if (state.contentEquals("RINGING")) {
    lock.disableKeyguard();
}
    lock.reenableKeyguard();


It seems to me that your "lock" object does not exist until the first call is made but I can't tell by looking at that piece of code.

I use windowmanager to unlock and lock my screen.

Window window = getWindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
    winParams.flags |= WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
    window.setAttributes(winParams);    

http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html

hope this helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜