Reputation: 209
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.
Upvotes: 0
Views: 45
Reputation: 4976
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.
Upvotes: 0