0

To unlock the screen in my service, I used disableKeyguard method in KeyguardManager.

KeyguardManager.KeyguardLock  kl = keyguardManager.newKeyguardLock("MyKeyguardLock");
kl.disableKeyguard();

However, it also removes the auto sleep/turn off my screen. I want to maintain the option. It means that the screen will be turned on using above code, then if the user does not press anything to screen, it will auto turn off after a period of time. I know a method to reenable the keyguardManager as kl.reenableKeyguard();, but it has to call somewhere. Thank you so much

user3051460
  • 1,455
  • 22
  • 58
  • How about using `CountDownTimer`? Start timer when user start app. And reset the timer each time user touch the app. But after some period of time user don't touch the app, reenable the keyguard. – ישו אוהב אותך Oct 24 '16 at 02:54
  • It is good one method, but we do not know the setting of user. For example, someone set screen off after 30 seconds, 10 seconds... It depends on user setting also – user3051460 Oct 24 '16 at 02:58

0 Answers0