如何更改 Android Things 设备上的日期? [英] How to change the date on Android Things device?

查看:18
本文介绍了如何更改 Android Things 设备上的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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 确定日期命令接受的格式.请注意,由于大多数开发套件没有电池供电的 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屋!

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