forked from upstream-mirrors/OpenTracks
Bugfix: prevent crash while stopping recording (race condition).
Part of #1328
This commit is contained in:
@@ -267,10 +267,11 @@ public class TrackRecordingService extends Service implements TrackPointCreator.
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newGpsStatus(GpsStatusValue gpsStatusValue) {
|
public void newGpsStatus(GpsStatusValue gpsStatusValue) {
|
||||||
notificationManager.updateContent(getString(gpsStatusValue.message));
|
|
||||||
|
|
||||||
//TODO This check should not be necessary, but prevents a crash; somehow the shutdown is not working correctly as we should not receive a notification then.
|
//TODO This check should not be necessary, but prevents a crash; somehow the shutdown is not working correctly as we should not receive a notification then.
|
||||||
|
// It is likely a race condition as the LocationManager provides location updates without using the Handler.
|
||||||
if (gpsStatusObservable != null) {
|
if (gpsStatusObservable != null) {
|
||||||
|
notificationManager.updateContent(getString(gpsStatusValue.message));
|
||||||
gpsStatusObservable.postValue(gpsStatusValue);
|
gpsStatusObservable.postValue(gpsStatusValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user