I'm developing a mapping app using Eclipse 3.5.
I'm setting the minimum update period with the LocationManager's requestLocationUpdates method, via a configuration activity. When I set the property I see in Logcat that the system process sets the value OK.
When I actually send a new location from the DDMS emulator control and the location changes on the map view, I see that the system process then sets the minimum time to zero.
Below is a capture of the system's log messages. You can see that I'm setting the period to 32 seconds, then 16, then, after I've sent a simulated location change the system sets it to zero
The map responds to location changes to location changes instantly even if they are sent only a couple of seconds apart.
Does anyone know why my minimum time is overridden by the system?
10-26 22:21:09.770: DEBUG/GpsLocationProvider(54): setMinTime 32000
10-26 22:21:53.011: DEBUG/GpsLocationProvider(54): stopNavigating
10-26 22:21:57.810: DEBUG/GpsLocationProvider(54): setMinTime 16000
10-26 22:21:57.810: DEBUG/GpsLocationProvider(54): startNavigating
10-26 22:21:57.900: DEBUG/GpsLocationProvider(54): setMinTime 16000
10-26 22:22:39.099: DEBUG/GpsLocationProvider(54): TTFF: 41290
10-26 22:22:39.350: DEBUG/GpsLocationProvider(54): setMinTime 0
10-26 22:22:51.740: DEBUG/GpsLocationProvider(54): TTFF: 53925
10-26 22:22:51.820: DEBUG/GpsLocationProvider(54): setMinTime 0
10-26 22:22:56.780: DEBUG/GpsLocationProvider(54): TTFF: 58967
10-26 22:22:56.879: DEBUG/GpsLocationProvider(54): setMinTime 0
pertinent code, below, enableGPS() called in onResume()
private void enableGPS() {
if (confData.getTrackMode() == AppConstants.GPS_ON) {
if (lm == null)
lm = (LocationManager) getSystemService(LOCATION_SERVICE);
long updateMillis = confData.getMapUpdatePeriod() * 1000;
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,
updateMillis, confData.getMapMinResendDistance(), this);
}
}
and listener is
public void onLocationChanged(Location location) {
List<Overlay> overlays = mv.getOverlays();
lo = new MyLocationOverlay(this, mv);
overlays.add(lo);
lo.enableMyLocation();
int lat = (int) (location.getLatitude() * 1E6);
int lng = (int) (location.getLongitude() * 1E6);
GeoPoint point = new GeoPoint(lat, lng);
mc.setCenter(point);
mv.invalidate();
}