Which uses - permission
do I need to use for this?
And how do I show the settings for the user to activate it?
Join Stack Overflow to learn, share knowledge, and build your career.
Which uses - permission
do I need to use for this?
And how do I show the settings for the user to activate it?
If you want your app to show users their display settings, you can achieve this with an intent:
Intent displaySettingsIntent = new Intent(Settings.ACTION_DISPLAY_SETTINGS);
startActivity(displaySettingsIntent);
You can add the code to a button click, so when users click on that button, their phone's display settings will be shown to them, and they can pick whichever one they want (15 secs, 30 secs, 1 minute, etc).
Note: This code will switch from your app to the display settings page and to return to your app, users will need to press the back button.
Sleep is a device OS Feature and only accessible to System Apps. You can lock sleeping by using WACK_LOCK permission.
To enable it:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
To disable it:
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);