0

I want to keep screen on while show trusted tabs. I was override the WebViewFallbackActivity class and inject this code but it's not working:

PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "WakelockTag");
wakeLock.acquire(10 * 60 * 1000L);

is there any solution to do this? Thanks.

Alireza
  • 209
  • 2
  • 3
  • 10

1 Answers1

0

There is a solution for this!

You need to use the web WakeLock API instead. I've used it in https://doom-fire.com/, and you can keep the screen on by clicking on the padlock icon. You can check the code my implementation here.

andreban
  • 4,621
  • 1
  • 20
  • 49