Discussion: How to modify the Android timeout sleep time _android

Source: Internet
Author: User

By default, the Android system does not operate for more than n minutes and automatically shuts down and goes into hibernation.
In fact, some projects require timeouts that do not hibernate, and if it's only for a single application, we can do it through the power management settings,
If you want to set the timeout for all applications, you can refer to the following methods:

Method One, adjust code:
Settings.System.putInt (Getcontentresolver (), android.provider.settings.system.screen_off_timeout,-1);
Permission:<uses-permission android:name= "Android.permission.WRITE_SETTINGS"/>

Method Two, adjust the database:
These settings for Android are stored in a SQL database, which means you can simply modify the database to keep Android from sleeping.
Sqlite3/data/data/com.android.providers.settings/databases/settings.db

Specific sql:
UPDATE system SET Value = '-1 ' WHERE name = ' Screen_off_timeout ';

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.