Why using network provider for location updates in Android GPS gives device time?
Whi开发者_如何学Cle using network provider for location updates, I found that it is the same time that I set on my device. Can it not be that provided by network as it goes when it is GPS. Or if network provider cannot provide time , then atleast location.getTime() should return 0 instead of device time. Is there any way to avoid device time, as I want to distinguish it.
The network provider doesnt supply your phone with a time as GPS does. There is no way to change that.
It's because network provider is using the locations of the GPRS/EDGE/WIFI/3G antennas your phone is connected to and calculates an aproximate position out of it - there is no specific "network location" service.
GPS or Navigational Satellite Timing and Ranging - Global Positioning System
(NAVSTAR GPS) on the other hand is designed for transmitting an atomic-clock exact timing signal.
It doesn't return null because when it's null, it'll use system time.
You can refer to the source code of Location.class
if (mTime == 0)
mTime = System.currentTimeMillis();
精彩评论