diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 942efcc87b..ae2e1f46b6 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -851,17 +851,16 @@ public class OsmandApplication extends Application { serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent); if (getNavigationService() == null) { if (intent == NavigationService.USED_BY_GPX) { - if (getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get() < 30000) { - getSettings().SERVICE_OFF_INTERVAL.set(0); - } else { - //Use SERVICE_OFF_INTERVAL > 0 to conserve power for longer GPX recording intervals - getSettings().SERVICE_OFF_INTERVAL.set(getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get()); - } + //for only-USED_BY_GPX case use pre-configured SERVICE_OFF_INTERVAL + getSettings().SERVICE_OFF_INTERVAL.set(); } else { + //other cases always use "continuous" getSettings().SERVICE_OFF_INTERVAL.set(0); } startService(serviceIntent); } else { + //additional cases always use "continuous" + //TODO: fallback to custom USED_BY_GPX interval in case all other sleep mode purposes have been stopped getSettings().SERVICE_OFF_INTERVAL.set(0); getNavigationService().addUsageIntent(intent); } diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java index ad634312a3..9925cbd259 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java @@ -345,10 +345,14 @@ 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); - //interval setting not needed here, handled centrally in app.startNavigationService - //if (app.getNavigationService() == null) { - // settings.SERVICE_OFF_INTERVAL.set(0); - //} + + if (settings.SAVE_GLOBAL_TRACK_INTERVAL.get() < 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.get()); + } + app.startNavigationService(NavigationService.USED_BY_GPX); } };