如何获取GPS时间或网络时间,location.getTime()返回错误的设备日期和时间。我在网上尝试了一些提示,但还没有答案。
这就是我现在所拥有的
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
datetime = location.getTime(); // the return time is from the device time.... not from the gps
Log.d("lat",""+location.getLatitude());
Log.d("long",""+location.getLongitude());
}
}