使用NTP的是Android同步的时间? [英] Is Android using NTP to sync time?
问题描述
做Android设备使用网络时间协议(NTP)同步时间?
Do Android Devices use the network time protocol (NTP) to synchronize the time?
在我的设备,设置我看到下面的文字与网络同步复选框,但如果他们使用NTP我不知道。
In my Device-Settings I see a checkbox with the following text "synchronize with network", but I don't know if they are using NTP.
我需要为我本科毕业论文的我用GPS。为了得到一个精确的GPS信号接收器应该有一个精确的时钟。
I need this for my Bachelor Thesis for which I use GPS. To get a accurate GPS-signal the receiver should have a exact clock.
我在网上找到了这个博客入境,但我不知道他是否说真话:的加快NTP,GPS锁定在Android中
I found this blog-entry on the web, but I'm not sure if he tell the truth: Speeding up NTP, GPS Lock in Android
推荐答案
我知道它使用调用自定义服务的Android ICS:<一href="http://$c$c.google.com/p/ics-custom-services/source/browse/java/com/android/server/NetworkTimeUpdateService.java?r=870506a4a9518ea90e44a41fdfe6e26d5d6e187d"><$c$c>NetworkTimeUpdateService$c$c>.该服务还实现了通过<一个一个NTP时间同步href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/4.0.1_r1/android/util/NtpTrustedTime.java"><$c$c>NtpTrustedTime$c$c>单身。
I know about Android ICS that it uses a custom service called: NetworkTimeUpdateService
. This service also implements a NTP time synchronization via the NtpTrustedTime
singleton.
在 NtpTrustedTime
NTP服务器从Android系统串源要求的默认值:
In NtpTrustedTime
the default NTP server is requested from the Android system string source:
final Resources res = context.getResources();
final String defaultServer = res.getString(
com.android.internal.R.string.config_ntpServer);
如果在系统设置中的自动时间同步选项被选中,并没有NITZ时间服务可用,那么时间将与 com.android.internal.R.string.config_ntpServer NTP服务器同步
。
If the automatic time sync option in the system settings is checked and no NITZ time service is available then the time will be synchronized with the NTP server from com.android.internal.R.string.config_ntpServer
.
要获取的值 com.android.internal.R.string.config_ntpServer
您可以使用下面的方法:
To get the value of com.android.internal.R.string.config_ntpServer
you can use the following method:
final Resources res = this.getResources();
final int id = Resources.getSystem().getIdentifier(
"config_ntpServer", "string","android");
final String defaultServer = res.getString(id);
这篇关于使用NTP的是Android同步的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!