I know its possible to use a wakelock to hold the screen, cpu, ect on but how can I programmatically change the "Screen Timeout" setting on an Android phone.
Enable stay awake modeFrom the settings page navigate to > About Tablet > Software Information. Then tap the "Build Number" 7 times to enable developer mode. Developers mode is where you'll find the Stay Awake option, toggle to enable.
The Settings.System provider offers a SCREEN_OFF_TIMEOUT setting that might be what you are looking for.
Above is correct:
Settings.System.putInt(getContentResolver(),Settings.System.SCREEN_OFF_TIMEOUT, DELAY);
But also include permission in manifest:
android:name="android.permission.WRITE_SETTINGS"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With