I got the following problem,
I have an unity Game which I would like to run. During running the Game, it always lowers screen lighting and switch of after about 2,5 minutes.
I already tried:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
and
PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"MyWakelockTag");
wakeLock.acquire();
Links:
Android disable screen timeout while app is running
Programmatically disable screen timeout
But after this, it still switches off as before.
Were there any changes done, in android or are there any other solutions to solve my problem.
Thanks.
Solution was very simple done using Unity adding the following Code into the Start() Function:
Screen.sleepTimeout = SleepTimeout.NeverSleep;
I doesn't know if it is switched of automatically by Unity or nor but I hope so.