How to change the date on Android Things device?

前端 未结 2 1056
青春惊慌失措
青春惊慌失措 2021-01-20 16:46

I\'m using Android Things Developer Preview on Raspberry Pi 3 Model B. Is there any way to set the correct date/time/timezone?

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 17:30

    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
    

    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.

提交回复
热议问题