如何在Android Things设备上更改日期? [英] How to change the date on Android Things device?
问题描述
我在Raspberry Pi 3 Model B上使用Android Things Developer Preview.是否可以设置正确的日期/时间/时区?
I'm using Android Things Developer Preview on Raspberry Pi 3 Model B. Is there any way to set the correct date/time/timezone?
推荐答案
最简单的方法可能是在ADB上使用 date
shell命令.它需要root用户,但是所有预览图像都应允许root用户访问.这是一个检查日期,设置日期然后验证日期更改是否卡住的示例:
The easiest way to do this is probably using the date
shell command over ADB. It requires root, but all the preview images should allow root access. Here's an example that checks the date, sets it, and then verifies that the date change stuck:
$ adb root
restarting adbd as root
$ adb shell date
Sat Jan 1 00:02:40 GMT 2000
$ adb shell date 1227120016
Tue Dec 27 12:00:00 GMT 2016
$ adb shell date
Tue Dec 27 12:00:02 GMT 2016
您可以通过 adb shell date -h
确定date命令接受的格式.请注意,由于大多数开发套件都没有电池支持的RTC,因此这种更改可能不会在整个电源循环中持续存在.
You can determine the format of the date command accepts via adb shell date -h
. Be aware that this change may not persist through a power cycle as most of the dev kits don't have a battery-backed RTC.
这篇关于如何在Android Things设备上更改日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!