我正在尝试编写一个简单的表单实用程序来配置附加的 android 设备。我需要执行的一项操作是更改系统时区、时间和时间格式。
我通过以下方式设置系统时区:
adb shell setprop persist.sys.timezone "America/Chicago"
通过更改时间
adb shell date -s YYYYMMDD.HHmmss
现在我需要设置设备的 12/24 小时格式,但我不知道该怎么做。它需要通过 adb 来完成。任何帮助表示赞赏,谢谢!
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%
启用 24 小时时间格式的命令是:
adb shell settings put system time_12_24 24