为您设置可以使用的时间
TimeManager.setTime()
方法:
要使用时间管理器控制设备设置,请首先请求
com.google.android.things.permission.SET_TIME
在你的
然后获取类的实例并设置
TimeManager timeManager = TimeManager.getInstance();
// Use 24-hour time
timeManager.setTimeFormat(TimeManager.FORMAT_24);
// Set time zone to Eastern Standard Time
timeManager.setTimeZone("America/New_York");
// Set clock time to noon
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MILLISECOND, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.HOUR_OF_DAY, 12);
long timeStamp = calendar.getTimeInMillis();
timeManager.setTime(timeStamp);
但是
Raspberry Pi 3
DS1307
或
DS3231
或者其他很多人(也可以看看
this
I2C
接口,所以您应该将RTC模块连接到您的板上,最初(当您的板连接到网络并且当前时间已知时)通过I2C设置实际时间,然后,在引导时从RTC模块获取当前时间并将其设置为Android Things系统,如上例所示。如何通过I2C控制DS3231 RTC
here
. 内部
User space
there
.
GPS
(例如,来自
RMC
句子)和
GSM
(例如。
AT+CLTS
UART
.