forked from organicmaps/organicmaps
[android] Add filtration of last location by timestamp.
This commit is contained in:
parent
d8594f305f
commit
b1724ad67d
1 changed files with 4 additions and 1 deletions
|
@ -185,8 +185,11 @@ public class LocationService implements LocationListener, SensorEventListener, W
|
|||
final Location l = m_locationManager.getLastKnownLocation(provider);
|
||||
if (l != null)
|
||||
{
|
||||
if (lastKnown == null || isBetterLocation(l, lastKnown))
|
||||
if ((System.currentTimeMillis() - l.getTime() < FIVE_MINUTES) &&
|
||||
(lastKnown == null || isBetterLocation(l, lastKnown)))
|
||||
{
|
||||
lastKnown = l;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue