Bugfix: TrackListActivity couldn't stop and restart sensors.

Part of #1780.
This commit is contained in:
Dennis Guse
2023-12-25 21:07:22 +01:00
parent 6cd627e832
commit 826cf0d468
2 changed files with 5 additions and 0 deletions
@@ -158,6 +158,7 @@ public class TrackListActivity extends AbstractTrackDeleteActivity implements Co
} else {
if (gpsStatusValue.isGpsStarted()) {
recordingStatusConnection.unbindAndStop(this);
recordingStatusConnection.startConnection(this); //TODO We need to stay listening!
} else {
new TrackRecordingServiceConnection((service, connection) -> {
service.tryStartSensors();
@@ -125,6 +125,9 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
if (isRecording()) {
endCurrentTrack();
}
if (isSensorStarted()) {
stopSensors();
}
PreferencesUtils.unregisterOnSharedPreferenceChangeListener(this);
@@ -248,6 +251,7 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
stopForeground(true);
notificationManager.cancelNotification();
wakeLock = SystemUtils.releaseWakeLock(wakeLock);
gpsStatusObservable.postValue(STATUS_GPS_DEFAULT);
}
@Override