reset SERVICE_OFF_INTERVAL to automatic settings for USED_BY_GPX if that is the only purpose left

This commit is contained in:
sonora 2014-08-28 01:02:14 +02:00
parent 9236d58ef3
commit 20ac432778

View file

@ -126,6 +126,17 @@ public class NavigationService extends Service implements LocationListener {
if((usedBy & usageIntent) > 0) { if((usedBy & usageIntent) > 0) {
usedBy -= usageIntent; usedBy -= usageIntent;
} }
if (usedBy == 2) {
//reset SERVICE_OFF_INTERVAL to automatic settings for USED_BY_GPX
if (app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get() < 30000) {
app.getSettings().SERVICE_OFF_INTERVAL.set(0);
} else {
//Use SERVICE_OFF_INTERVAL > 0 to conserve power for longer GPX recording intervals
app.getSettings().SERVICE_OFF_INTERVAL.set(app.getSettings().SAVE_GLOBAL_TRACK_INTERVAL.get());
}
}
if (usedBy == 0) { if (usedBy == 0) {
final Intent serviceIntent = new Intent(ctx, NavigationService.class); final Intent serviceIntent = new Intent(ctx, NavigationService.class);
ctx.stopService(serviceIntent); ctx.stopService(serviceIntent);