Replace cached location with current

This commit is contained in:
Alex Sytnyk 2018-05-25 15:43:36 +03:00
parent 87e8368856
commit 5f05110d0d

View file

@ -867,8 +867,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;
}
}