Android Setting settings never hibernate

Source: Internet
Author: User

By default, the Android system does not operate for more than n minutes, and it automatically shuts down and goes into hibernation .
In fact, some projects require time-outs not to hibernate , and if it's only for a single application, we can do it through the power management settings state.

If you want to set the time - out for all apps, you can refer to the following methods:

Method One, adjust the code:

Settings.System.putInt (Getcontentresolver (), android.provider.settings.system.screen_off_timeout,-1);

Permissions: <uses-permission android:name= "Android.permission.WRITE_SETTINGS"/>

Method Two, adjust the database:

Android's settings are stored in the SQL database, which means you can modify the database directly to not let Android sleep.

Sqlite3/data/data/com.android.providers.settings/databases/settings.db

Specific sql:

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

Android Setting settings never hibernate

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.