summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
index 662bab4..a228ec7 100644
--- a/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
+++ b/src/com/cyanogenmod/lockclock/weather/WeatherUpdateService.java
@@ -58,6 +58,7 @@ public class WeatherUpdateService extends Service {
private static final long LOCATION_REQUEST_TIMEOUT = 5L * 60L * 1000L; // request for at most 5 minutes
private static final long OUTDATED_LOCATION_THRESHOLD_MILLIS = 10L * 60L * 1000L; // 10 minutes
+ private static final float LOCATION_ACCURACY_THRESHOLD_METERS = 50000;
private WeatherUpdateTask mTask;
@@ -169,6 +170,11 @@ public class WeatherUpdateService extends Service {
Location location = lm.getLastKnownLocation(LocationManager.PASSIVE_PROVIDER);
if (D) Log.v(TAG, "Current location is " + location);
+ if (location != null && location.getAccuracy() > LOCATION_ACCURACY_THRESHOLD_METERS) {
+ if (D) Log.d(TAG, "Ignoring inaccurate location");
+ location = null;
+ }
+
// If lastKnownLocation is not present (because none of the apps in the
// device has requested the current location to the system yet) or outdated,
// then try to get the current location use the provider that best matches the criteria.