By default, the android system does not operate for more than n minutes, and the screen is automatically closed and sleep.
In fact, some projects require timeout and not sleep.Program, We can achieve this through the power management setting status,
If you want to set the timeout time for all applications, you can refer to the following methods:
Method 1. AdjustmentCode:
Settings. system. putint (getcontentresolver (), Android. provider. settings. system. screen_off_timeout,-1 );
Permission:<Uses-Permission Android: Name = "android. Permission. write_settings"/>
Method 2: Adjust the database:
These settings of Android are stored in the SQL database, that is, you can directly modify the database to prevent android from sleep.
Sqlite3/data/COM. Android. providers. Settings/databases/settings. DB
Specific SQL:
Update System set value = '-1' where name = 'screen _ off_timeout ';