0

Is it possible to change the delay before launching the screen saver on Android ?

Currently I have two methods to enable or disable the KEEP_SCREEN_ON but I can not find anything to handle the sleep time :

private fun keepScreenOn() = window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
private fun removeScreenOn() = window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
Jéwôm'
  • 3,753
  • 5
  • 40
  • 73

1 Answers1

1

Duplicate of Android Screen Timeout

Settings.System.putInt(getContentResolver(),Settings.System.SCREEN_OFF_TIMEOUT, DELAY); 

Add the following permission to your manifest:

android:name="android.permission.WRITE_SETTINGS"
Isak
  • 116
  • 9