Bugfix: keep TrackRecordingService in foreground if paused.

This commit is contained in:
Dennis Guse
2020-02-03 20:14:15 +01:00
parent dc1b50a7bf
commit bbb6a7c22c
@@ -708,17 +708,7 @@ public class TrackRecordingService extends Service {
}
private void showNotification(boolean isGpsStarted) {
// Dijkstra If
if (isRecording() && isPaused()) {
stopForeground(true);
notificationManager.cancelNotification();
}
if (!isRecording() && !isGpsStarted) {
stopForeground(true);
notificationManager.cancelNotification();
}
if (isRecording() && !isPaused()) {
if (isRecording()) {
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
PendingIntent pendingIntent = TaskStackBuilder.create(this)
@@ -740,5 +730,9 @@ public class TrackRecordingService extends Service {
notificationManager.updateContent(getString(R.string.gps_starting));
startForeground(TrackRecordingServiceNotificationManager.NOTIFICATION_ID, notificationManager.getNotification());
}
if (!isRecording() && !isGpsStarted) {
stopForeground(true);
notificationManager.cancelNotification();
}
}
}