streamline code setting SERVICE_OFF_INTERVAL

This commit is contained in:
sonora 2014-08-27 09:26:53 +02:00
parent bc6ec22a6d
commit 61dbdf81ce
3 changed files with 6 additions and 3 deletions

View file

@ -851,11 +851,12 @@ public class OsmandApplication extends Application {
serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent); serviceIntent.putExtra(NavigationService.USAGE_INTENT, intent);
if (getNavigationService() == null) { if (getNavigationService() == null) {
if (intent != NavigationService.USED_BY_GPX) { 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); getSettings().SERVICE_OFF_INTERVAL.set(0);
} }
startService(serviceIntent); startService(serviceIntent);
} else { } else {
getSettings().SERVICE_OFF_INTERVAL.set(0);
getNavigationService().addUsageIntent(intent); getNavigationService().addUsageIntent(intent);
} }
} }

View file

@ -83,7 +83,8 @@ public class OsMoControlDevice implements OsMoReactor {
} else if(data.equals("START_TRACKING")) { } else if(data.equals("START_TRACKING")) {
tracker.enableTracker(); tracker.enableTracker();
app.startNavigationService(NavigationService.USED_BY_LIVE); 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")) { } else if(data.equals("OSMAND_INFO")) {
JSONObject robj = new JSONObject(); JSONObject robj = new JSONObject();
try { try {

View file

@ -179,7 +179,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
osMoPlugin.getTracker().enableTracker(); osMoPlugin.getTracker().enableTracker();
} }
app.startNavigationService(NavigationService.USED_BY_LIVE); 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 { } else {
if (osMoPlugin != null && osMoPlugin.getTracker() != null){ if (osMoPlugin != null && osMoPlugin.getTracker() != null){
osMoPlugin.getTracker().disableTracker(); osMoPlugin.getTracker().disableTracker();