防止屏幕休眠 [英] Prevent screen sleeping

查看:112
本文介绍了防止屏幕休眠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android v4.2.2.我试图阻止屏幕进入睡眠状态.我已经尝试过一些操作,例如更改db中的相关设置:

Android v4.2.2. I'm trying to stop the screen from going to sleep. I've tried a few things like changing the relevant settings in the db:

adb shell "sqlite3 /data/data/com.android.providers.settings/databases/settings.db  \"update system set value='-1' where name='screen_off_timeout'\";"

但是那没用-屏幕几乎立即进入睡眠状态.如果我转到设置应用程序,则无法选择禁用它.取而代之的是,它的范围从15s到30m.

But that didn't work - screen just went to sleep almost immediately. If I go to the settings app there isn't an option to disable it. Instead, it ranges from 15s to 30m.

我还尝试在应用程序中设置 KEEP_SCREEN_ON 标记,但是当我切换到新活动时,该标记将停止工作.

I have also tried to set the KEEP_SCREEN_ON FLAG in the application but that stops working when I switch to a new activity.

还有什么我可以尝试的.我希望数据库设置可以完成这项工作.这是我的系统数据库.也许我缺少一个可以插入的设置?

Is there anything else I can try. I was hoping a db setting would do the job. Here is my system db as it stands. Perhaps a setting I am missing and can insert?

1|volume_music|11
2|volume_ring|5
3|volume_system|7
4|volume_voice|4
5|volume_alarm|6
6|volume_notification|5
7|volume_bluetooth_sco|7
8|mode_ringer_streams_affected|174
9|mute_streams_affected|46
10|vibrate_when_ringing|0
11|dim_screen|0
13|dtmf_tone_type|0
14|hearing_aid|0
15|tty_mode|0
16|screen_brightness|102
17|screen_brightness_mode|0
18|window_animation_scale|1.0
19|transition_animation_scale|1.0
20|accelerometer_rotation|1
21|haptic_feedback_enabled|1
22|notification_light_pulse|1
23|dtmf_tone|1
24|sound_effects_enabled|1
26|lockscreen_sounds_enabled|1
27|pointer_speed|0
28|next_alarm_formatted|
29|alarm_alert|content://media/internal/audio/media/5
30|notification_sound|content://media/internal/audio/media/7
31|ringtone|content://media/internal/audio/media/9
32|volume_music_headset|10
33|volume_music_last_audible_headset|10
34|volume_music_headphone|10
35|volume_music_last_audible_headphone|10
36|time_12_24|24
37|date_format|dd-MM-yyyy
39|stay_on_while_plugged_in|1
45|screen_off_timeout|-1

推荐答案

您的设置db包含系统设置的默认超时时间,该超时时间可能很短,因此由于超时值较低,设备会立即进入睡眠状态.您可以发出adb shell命令来增加屏幕超时.

Your setting db contains default time out set by the system which is probably low so the device went to sleep immediately due to low timeout value. You can issue adb shell command to increase screen timeout.

adb shell settings put system screen_off_timeout 60000

注意:60000 = 1分钟

Note: 60000 = 1 minute

您还可以使用所需的超时更新设置db,然后将db推回设备,但它需要root用户.上面的命令不需要将设备植根.

You can also update setting db with the desired timeout and then push db back to device but it requires root. Above command does not require device to be rooted.

这篇关于防止屏幕休眠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆