From 8d6f25eab006c360ce2c2cdbe1208d14fe266bb4 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Mon, 13 Feb 2012 20:03:51 +0300 Subject: [PATCH] [android] Enabled location filtering if it's older than 5 minutes --- .../src/com/mapswithme/maps/location/LocationService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/src/com/mapswithme/maps/location/LocationService.java b/android/src/com/mapswithme/maps/location/LocationService.java index 02c7917b3d..13640a6c44 100644 --- a/android/src/com/mapswithme/maps/location/LocationService.java +++ b/android/src/com/mapswithme/maps/location/LocationService.java @@ -183,15 +183,16 @@ public class LocationService implements LocationListener, SensorEventListener, W } private static final int TWO_MINUTES = 1000 * 60 * 2; + private static final int FIVE_MINUTES = 1000 * 60 * 5; // Determines whether one Location reading is better than the current Location // @param location The new Location that you want to evaluate // @param currentBestLocation The current Location fix, to which you want to compare the new one protected boolean isBetterLocation(Location newLocation, Location currentBestLocation) { -// // A new location is thrown away if it's too old -// if (java.lang.System.currentTimeMillis() - newLocation.getTime() > TWO_MINUTES) -// return false; + // A new location is thrown away if it's too old + if (java.lang.System.currentTimeMillis() - newLocation.getTime() > FIVE_MINUTES) + return false; // A new location is better than no location if (currentBestLocation == null)