From 61dbdf81cec68fe6509105c60e4be3adbbed4320 Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 27 Aug 2014 09:26:53 +0200 Subject: [PATCH] streamline code setting SERVICE_OFF_INTERVAL --- OsmAnd/src/net/osmand/plus/OsmandApplication.java | 3 ++- OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java | 3 ++- OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 1ce8af4f6f..f640110cad 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -851,11 +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 + //Use pre-selected SERVICE_OFF_INTERVAL for global GPX recording, else getSettings().SERVICE_OFF_INTERVAL.set(0); } startService(serviceIntent); } else { + getSettings().SERVICE_OFF_INTERVAL.set(0); getNavigationService().addUsageIntent(intent); } } diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java index 0629236a73..a14b1493a2 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoControlDevice.java @@ -83,7 +83,8 @@ public class OsMoControlDevice implements OsMoReactor { } else if(data.equals("START_TRACKING")) { tracker.enableTracker(); app.startNavigationService(NavigationService.USED_BY_LIVE); - app.getSettings().SERVICE_OFF_INTERVAL.set(0); + //interval setting not needed here, handled centrally in app.startNavigationService + //app.getSettings().SERVICE_OFF_INTERVAL.set(0); } else if(data.equals("OSMAND_INFO")) { JSONObject robj = new JSONObject(); try { diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java index 4cb27b722c..c2e7525008 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoGroupsActivity.java @@ -179,7 +179,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements osMoPlugin.getTracker().enableTracker(); } app.startNavigationService(NavigationService.USED_BY_LIVE); - app.getSettings().SERVICE_OFF_INTERVAL.set(0); + //interval setting not needed here, handled centrally in app.startNavigationService + //app.getSettings().SERVICE_OFF_INTERVAL.set(0); } else { if (osMoPlugin != null && osMoPlugin.getTracker() != null){ osMoPlugin.getTracker().disableTracker();