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