I have 100+ android devices on a network. These devices constantly loosing time (time is not accurate +- few hours or sets to default date time 2010 ... 00:00 ) and I would like to synchronise time and date with android NTP. I can't root those devices. These devices are on a network without internet. I believe only one solution is to create exception in our firewall to allow devices to connect to android NTP server??? How can I find this URL. Is it another option so sync date time?
Asked
Active
Viewed 1,000 times
0
Klapsius
- 3,273
- 6
- 33
- 56
1 Answers
2
To get internet time by following code snippet:
public long getInternetTime() {
SntpClient client = new SntpClient();
if (client.requestTime("time.nist.gov", 10000)) {
long time = client.getNtpTime();
return time;
}
else {
Log.e(TAG, "get internet time failed");
}
return -1;
}
aolphn
- 2,950
- 2
- 21
- 30
-
I'm not a Android developer. I need to sync time with internet time (default android NTP) but i can't see witch server is in use. Because my device is't rooted – Klapsius Oct 31 '18 at 09:57
-
Did you must use default android ntp server? – aolphn Oct 31 '18 at 09:59
-
Check this question https://stackoverflow.com/questions/14381005/is-android-using-ntp-to-sync-time – aolphn Oct 31 '18 at 10:00
-
I can't root my devices so yes I have to use default NTP – Klapsius Oct 31 '18 at 14:53
-
In my answer,you can use ntp without need root your device – aolphn Oct 31 '18 at 14:54