I’m registering for location updates:
public void onResume() {
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
for (String it : providers) {
lm.requestLocationUpdates(it, 0, 0, myListener);
}
}
Now will any new location fixes received be cached in the providers? In other words, if the gps listener got a new fix 1 second ago, calling the following:
Location loc = lm.getProvider("gps").getLastKnownLocation("gps");
should give me back that latest location, right? Just wondering if there’s any policy for a provider where it might not return back its latest fix (ie. it receives a fix, but the internal implementation doesn’t cache it as the last known location for some reason, or there’s some timeout before it gets served up as the last-known),
Thanks
If you check source of LocationManagerService.java you can see the last known location for provider is updated if the location provider is enabled, so the answer is Yes.