Method 1,
Sometimes, before the LCD, touchscreen, or keyboard is properly adjusted, Android will suspend in 10 seconds by default, resulting in System sleep. You cannot use the android menu to modify the timeout value. In fact, these Android settings 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
Select * from system;
Update System set value = '000000' where name = 'screen _ off_timeout ';
Update System set value = '-1' where name = 'screen _ off_timeout ';
. Exit
Insert into system ('name', 'value') values ('lock _ pattern_autolock', 1 );
Method 2,
Find soundanddisplaysettings. Java
Listpreference screentimeoutpreference =
(Listpreference) findpreference (key_screen_timeout );
// Screentimeoutpreference. setvalue (string. valueof (settings. system. getint (
// Resolver, screen_off_timeout, fallback_screen_timeout_value )));
Screentimeoutpreference. setvalue ("-1 ");
Screentimeoutpreference. setonpreferencechangelistener (this );