I would like in my application to find a way to synch the date and time with something given by an external source.
I don’t want to use the phone time because I might get a difference of maybe 5 minutes around real time. and 5 minutes extra or less = 10 minutes!
I have heard about time information in the GPS satellites or in Network antennas.
I have tried with System.getCurrentTime but i get the current the of the device, so, if my device is set up 5 minutes earlier, it display the wrong time.
EDIT
To make a short question: how can I get this time?

I didn’t know, but found the question interesting. So I dug in the android code… Thanks open-source 🙂
The screen you show is
DateTimeSettings. The checkbox “Use network-provided values” is associated to the shared preferenceString KEY_AUTO_TIME = "auto_time";and also toSettings.System.AUTO_TIMEThis settings is observed by an observed called
mAutoTimeObserverin the 2 networkServiceStateTrackers:GsmServiceStateTrackerandCdmaServiceStateTracker.Both implementations call a method called
revertToNitz()when the settings becomes true.Apparently NITZ is the equivalent of NTP in the carrier world.
Bottom line: You can set the time to the value provided by the carrier thanks to
revertToNitz().Unfortunately, I haven’t found a mechanism to get the network time.
If you really need to do this, I’m afraid, you’ll have to copy these
ServiceStateTrackers implementations, catch the intent raised by the framework (I suppose), and add a getter tomSavedTime.