From 07ab3ecb00dee9f37deaad8eaab294a8d571e0a3 Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 27 Aug 2014 21:08:19 +0200 Subject: [PATCH] test longer SERVICE_OFF_INTERVALs for longer global GPX recording intervals --- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 7 ++++++- .../osmand/plus/monitoring/OsmandMonitoringPlugin.java | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 3a9370353f..bcd4c066a3 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -851,7 +851,12 @@ public class OsmandApplication extends Application { serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent); if (getNavigationService() == null) { if (intent == NavigationService.USED_BY_GPX) { - //Use pre-selected SERVICE_OFF_INTERVAL for global GPX recording, else + if (settings.SAVE_GLOBAL_TRACK_INTERVAL.set() < 30000) { + settings.SERVICE_OFF_INTERVAL.set(0); + } else { + //Use SERVICE_OFF_INTERVAL > 0 to conserve power for longer GPX recording intervals + settings.SERVICE_OFF_INTERVAL.set(settings.SAVE_GLOBAL_TRACK_INTERVAL.set()); + } getSettings().SERVICE_OFF_INTERVAL.set(); } else { getSettings().SERVICE_OFF_INTERVAL.set(0); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index 736db1451d..ad634312a3 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -333,7 +333,7 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn bld.show(); } } - + private void startGPXMonitoring(MapActivity map) { app.getSavingTrackHelper().startNewSegment(); final ValueHolder vs = new ValueHolder(); @@ -345,9 +345,10 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn settings.SAVE_GLOBAL_TRACK_INTERVAL.set(vs.value); settings.SAVE_GLOBAL_TRACK_TO_GPX.set(true); settings.SAVE_GLOBAL_TRACK_REMEMBER.set(choice.value); - if (app.getNavigationService() == null) { - settings.SERVICE_OFF_INTERVAL.set(0); - } + //interval setting not needed here, handled centrally in app.startNavigationService + //if (app.getNavigationService() == null) { + // settings.SERVICE_OFF_INTERVAL.set(0); + //} app.startNavigationService(NavigationService.USED_BY_GPX); } };