Replace cached location with current

This commit is contained in:
Alex Sytnyk 2018-05-25 15:43:36 +03:00
parent 0d1c54f534
commit 285d3c1a6c

View file

@ -874,8 +874,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
if (loc != null) {
int counter = locationRequestsCounter.incrementAndGet();
if (counter >= REQUESTS_BEFORE_CHECK_LOCATION && locationRequestsCounter.compareAndSet(counter, 0)) {
net.osmand.Location cached = cachedLocation;
if (cached != null && System.currentTimeMillis() - cached.getTime() > LOCATION_TIMEOUT_TO_BE_STALE) {
if (System.currentTimeMillis() - loc.getTime() > LOCATION_TIMEOUT_TO_BE_STALE) {
location = null;
}
}