Just use this command to set a server address to automatically sync your device time. ( ͡° ͜ʖ ͡°)✧
1 | $ adb shell settings put global ntp_server <new-ntp-server> |
Background
I have a Raspberry Pi 3 with Android Things installed on it. But the time is never synchronized…
After googling it, I found this piece of code in NtpTrustedTime.java
1 | public class NtpTrustedTime implements TrustedTime { |
It shows that android tring to get NTP server from:
Settings.Global.NTP_SERVER first
Then com.android.internal.R.string.config_ntpServer
And the NTP server of my Android Things is time.android.com
, that’s why it dose not work (I’m in China…).
Fortunately, it is easy to set settings via adb:
1 | $ adb shell settings put global ntp_server asia.pool.ntp.org |
:tada: CHEERS