batsheva batsheva - 3 years ago 154
Android Question

how to set in my application Sleep after 5 minutes of inactivity screen? (Android)

Which

uses - permission
do I need to use for this?

And how do I show the settings for the user to activate it?

Thanks in advance!

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download