WakeLock.release() switches off screen even if the user was interacting with the app

StackOverflow https://stackoverflow.com/questions/18389157

  •  26-06-2022
  •  | 
  •  

Вопрос

My app wakes the phone from standby and turns on the screen (SCREEN_BRIGHT_WAKE_LOCK). I can't use the WindowManager-flags approach, as my app may already be running in the background.

The problem is that once the user dismisses my app and the WakeLock is released, the screen turns off immediately, even if the user was interacting with the app (or the homescreen, which briefly shows while the app is being closed).

Would using the ON_AFTER_RELEASE-flag help?

Это было полезно?

Решение

Yes, you want to use the ON_AFTER_RELEASE flag.

When this wake lock is released, poke the user activity timer so the screen stays on for a little longer.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top