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
精彩评论