0

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();
brc
  • 5,281
  • 2
  • 29
  • 30
shanker
  • 11
  • 1

1 Answers1

0

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

Carlos
  • 73
  • 7