From 75b2f7f77f4d8849229b865edb30cd07a3e57a31 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 16 Jul 2019 15:58:47 +0200 Subject: [PATCH] Location interval as constant --- .../nightscout/androidaps/services/LocationService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/services/LocationService.java b/app/src/main/java/info/nightscout/androidaps/services/LocationService.java index 4cb6f577e8..9d4c2a78d1 100644 --- a/app/src/main/java/info/nightscout/androidaps/services/LocationService.java +++ b/app/src/main/java/info/nightscout/androidaps/services/LocationService.java @@ -26,6 +26,9 @@ public class LocationService extends Service { private LocationManager mLocationManager = null; private static final float LOCATION_DISTANCE = 10f; + private static final long LOCATION_INTERVAL_ACTIVE = T.mins(5).msecs(); + private static final long LOCATION_INTERVAL_PASSIVE = T.mins(1).msecs(); // this doesn't cost more power + public LocationService() { MainApp.bus().register(this); } @@ -93,21 +96,21 @@ public class LocationService extends Service { if (SP.getString(R.string.key_location, "NONE").equals("NETWORK")) mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, - T.mins(5).msecs(), + LOCATION_INTERVAL_ACTIVE, LOCATION_DISTANCE, mLocationListener = new LocationListener(LocationManager.NETWORK_PROVIDER) ); if (SP.getString(R.string.key_location, "NONE").equals("GPS")) mLocationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, - T.mins(5).msecs(), + LOCATION_INTERVAL_ACTIVE, LOCATION_DISTANCE, mLocationListener = new LocationListener(LocationManager.GPS_PROVIDER) ); if (SP.getString(R.string.key_location, "NONE").equals("PASSIVE")) mLocationManager.requestLocationUpdates( LocationManager.PASSIVE_PROVIDER, - T.mins(1).msecs(), + LOCATION_INTERVAL_PASSIVE, LOCATION_DISTANCE, mLocationListener = new LocationListener(LocationManager.PASSIVE_PROVIDER) );