From 94418fccdd41116f51a402d2d6634296e3a267c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20P=C3=B3=C5=82grabia?= Date: Sun, 9 Oct 2016 11:51:14 +0200 Subject: [PATCH] Fixing issue with logging and refreshing policy from settings. --- app/src/main/assets/logback.xml | 2 +- .../java/pl/tpolgrabia/urbanexplorer/MainActivity.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/assets/logback.xml b/app/src/main/assets/logback.xml index fa4036d..e774280 100644 --- a/app/src/main/assets/logback.xml +++ b/app/src/main/assets/logback.xml @@ -6,7 +6,7 @@ ${LOG_DIR}/logs/urban-explorer.txt - %d{HH:mm:ss.SSS} [%-20thread] %-5level %logger{36} - %msg + %d{HH:mm:ss.SSS} [%-20thread] %-5level %logger{36} - %msg\n diff --git a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java index 2b3c1e8..754c25c 100644 --- a/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java +++ b/app/src/main/java/pl/tpolgrabia/urbanexplorer/MainActivity.java @@ -301,13 +301,13 @@ public class MainActivity extends ActionBarActivity { lg.debug("Selected location provider {} is available", locationProvider); - final Long updateTime = HelperUtils.fetchGpsUpdateFreq(this); - lg.debug("Update time: {}", updateTime); + final Long updateTimeInMinutes = HelperUtils.fetchGpsUpdateFreq(this); + lg.debug("Update time: {}", updateTimeInMinutes); if (locationProvider != null) { lg.debug("Requesting location updates"); LocationManager locationService = (LocationManager)getSystemService(LOCATION_SERVICE); locationService.requestLocationUpdates(locationProvider, - updateTime, + updateTimeInMinutes, HelperUtils.fetchGpsDistanceFreq(this), locationCallback); locationServicesActivated = true; @@ -318,7 +318,7 @@ public class MainActivity extends ActionBarActivity { lg.debug("Now: {}", now); final long lastLocationUpdateTimeAgo = now - lastLocationUpdateTime; lg.debug("Last location update was {} ms ago", lastLocationUpdateTimeAgo); - if (lastLocationUpdateTime < 0 || lastLocationUpdateTimeAgo >= updateTime) { + if (lastLocationUpdateTime < 0 || lastLocationUpdateTimeAgo >= updateTimeInMinutes*1000.0) { lg.info("Last location update time exceeded. Requesting single update..."); locationService.requestSingleUpdate(locationProvider, locationCallback, Looper.getMainLooper()); }