Stop foreground in DownloadService before calling stop
This commit is contained in:
parent
4decd1d9fe
commit
f5bbdf1666
|
@ -168,6 +168,7 @@ public class DownloadService extends Service {
|
||||||
startForeground(R.id.notification_downloading, notification);
|
startForeground(R.id.notification_downloading, notification);
|
||||||
syncExecutor.execute(() -> onDownloadQueued(intent));
|
syncExecutor.execute(() -> onDownloadQueued(intent));
|
||||||
} else if (numberOfDownloads.get() == 0) {
|
} else if (numberOfDownloads.get() == 0) {
|
||||||
|
stopForeground(true);
|
||||||
stopSelf();
|
stopSelf();
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "onStartCommand: Unknown intent");
|
Log.d(TAG, "onStartCommand: Unknown intent");
|
||||||
|
@ -553,6 +554,7 @@ public class DownloadService extends Service {
|
||||||
|
|
||||||
if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) {
|
if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) {
|
||||||
Log.d(TAG, "Number of downloads is " + numberOfDownloads.get() + ", attempting shutdown");
|
Log.d(TAG, "Number of downloads is " + numberOfDownloads.get() + ", attempting shutdown");
|
||||||
|
stopForeground(true);
|
||||||
stopSelf();
|
stopSelf();
|
||||||
if (notificationUpdater != null) {
|
if (notificationUpdater != null) {
|
||||||
notificationUpdater.run();
|
notificationUpdater.run();
|
||||||
|
|
Loading…
Reference in New Issue