fix that manual adjustmaent of GPX wae-up was ignored

This commit is contained in:
sonora 2014-08-27 23:05:55 +02:00
parent 462e92ca3c
commit 3ce777fde4
2 changed files with 13 additions and 10 deletions

View file

@ -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);
}

View file

@ -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);
}
};