2012-12-14 213 views
3

我正在尝试编写一个简单的表单工具来配置附加的android设备。我需要执行的操作之一是更改系统时区,时间和时间格式。通过adb shell设置系统时间格式

我通过设置系统时区:

adb shell setprop persist.sys.timezone "America/Chicago" 

通过

adb shell date -s YYYYMMDD.HHmmss 

现在我需要设置设备的12/24小时格式更改时间,但我不知道如何做到这一点。它需要通过adb完成。任何帮助表示赞赏,谢谢!

回答

1

的命令启用24小时的时间格式为:

adb shell settings put system time_12_24 24 
+0

它给了我一个错误说设置未找到。这些设备运行Android 2.3,如果这有所作为。 – FlyingStreudel

+0

为2.3您将不得不使用sqlite命令 我没有任何旧设备可以尝试此操作。但你有这个想法 –

7
IF "%time:~0,1%"==" " (
    SET mynow=%date:~-4,4%%date:~-10,2%%date:~-7,2%.0%time:~1,1%%time:~3,2%%time:~6,2% 
) ELSE (
    set mynow=%date:~-4,4%%date:~-10,2%%date:~-7,2%.%time:~0,2%%time:~3,2%%time:~6,2% 
) 


REM sourced from: 
REM http://developer.android.com/reference/android/provider/Settings.System.html 

REM STILL NEED 
REM font scale = 1.25 (display -> font size = extra large) 
REM screen lock = none (security -> screen lock) 
REM scheduled power off 10:30pm daily (scheduled power on & off 


REM allow apps from unknown sources (settings-> developer options) 
adb shell settings put secure install_non_market_apps 1 

REM ... (settings-> developer options) 
adb shell settings put global stay_on_while_plugged_in 3 

REM display off after 30 minutes (settings-> display) 
adb shell settings put system screen_off_timeout 1800000 

REM display Font Scale X-Large (settings-> display) 
REM write setting not working, read setting works fine 
REM adb shell settings put system font_scale 1.25 


REM set default rotation state to horizontal 
adb shell settings put system user_rotation 0 

REM use 12 hour format (settings->date & time) 
adb shell settings put system time_12_24 12 

REM Automatic date & time = use network provided (settings->date & time) 
REM adb shell settings put global auto_time 1 
REM Automatic date & time = OFF (settings->date & time) 
adb shell settings put global auto_time 0 

REM Automatic time zone = use network provided time-zone (settings->date & time) 
REM adb shell settings put global auto_time_zone 1 
REM Automatic time zone = OFF (settings->date & time) 
adb shell settings put global auto_time_zone 0 


REM set Date & Time 
adb shell su 0 date -s %mynow% 
+0

我在哪里可以得到这种类型的命令的完整列表? –

相关问题