Making sure that DownloadService always calls startForeground
This commit is contained in:
parent
4bda044472
commit
5f5cf628ca
|
@ -163,11 +163,15 @@ public class DownloadService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if (intent != null &&
|
if (intent != null && intent.getParcelableArrayListExtra(EXTRA_REQUESTS) != null) {
|
||||||
intent.getParcelableArrayListExtra(EXTRA_REQUESTS) != null) {
|
Notification notification = notificationManager.updateNotifications(
|
||||||
|
requester.getNumberOfDownloads(), downloads);
|
||||||
|
startForeground(NOTIFICATION_ID, notification);
|
||||||
onDownloadQueued(intent);
|
onDownloadQueued(intent);
|
||||||
} else if (numberOfDownloads.get() == 0) {
|
} else if (numberOfDownloads.get() == 0) {
|
||||||
stopSelf();
|
stopSelf();
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "onStartCommand: Unknown intent");
|
||||||
}
|
}
|
||||||
return Service.START_NOT_STICKY;
|
return Service.START_NOT_STICKY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue