I'm trying to get my app to reenable the keyguard after x amount of time passes (using alarm manager). Basically, here is what I do:
Let's say I set the screen lock to be enabled after 5 minutes.
Now let's say we keep the same scenario as above, but change step 2 to:
This seems to indicate to me that re-enabling the keyguard only takes affect after the screen goes on again and you cannot enable it while the screen is off. Am I wrong or is there another way around this? I would like to be able to kick the user back to the lock screen even if the code re-enables the lock guard while the screen is off.
Thanks!
Answer was to use:
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, this.getClass().getSimpleName());
wl.acquire();
before re-enabling the keyguard
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.