forked from upstream-mirrors/OpenTracks
Bugfix: keep TrackRecordingService in foreground if paused.
This commit is contained in:
@@ -708,17 +708,7 @@ public class TrackRecordingService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showNotification(boolean isGpsStarted) {
|
private void showNotification(boolean isGpsStarted) {
|
||||||
// Dijkstra If
|
if (isRecording()) {
|
||||||
if (isRecording() && isPaused()) {
|
|
||||||
stopForeground(true);
|
|
||||||
notificationManager.cancelNotification();
|
|
||||||
|
|
||||||
}
|
|
||||||
if (!isRecording() && !isGpsStarted) {
|
|
||||||
stopForeground(true);
|
|
||||||
notificationManager.cancelNotification();
|
|
||||||
}
|
|
||||||
if (isRecording() && !isPaused()) {
|
|
||||||
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
Intent intent = IntentUtils.newIntent(this, TrackDetailActivity.class)
|
||||||
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
.putExtra(TrackDetailActivity.EXTRA_TRACK_ID, recordingTrackId);
|
||||||
PendingIntent pendingIntent = TaskStackBuilder.create(this)
|
PendingIntent pendingIntent = TaskStackBuilder.create(this)
|
||||||
@@ -740,5 +730,9 @@ public class TrackRecordingService extends Service {
|
|||||||
notificationManager.updateContent(getString(R.string.gps_starting));
|
notificationManager.updateContent(getString(R.string.gps_starting));
|
||||||
startForeground(TrackRecordingServiceNotificationManager.NOTIFICATION_ID, notificationManager.getNotification());
|
startForeground(TrackRecordingServiceNotificationManager.NOTIFICATION_ID, notificationManager.getNotification());
|
||||||
}
|
}
|
||||||
|
if (!isRecording() && !isGpsStarted) {
|
||||||
|
stopForeground(true);
|
||||||
|
notificationManager.cancelNotification();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user