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
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
if (intent != null &&
|
||||
intent.getParcelableArrayListExtra(EXTRA_REQUESTS) != null) {
|
||||
if (intent != null && intent.getParcelableArrayListExtra(EXTRA_REQUESTS) != null) {
|
||||
Notification notification = notificationManager.updateNotifications(
|
||||
requester.getNumberOfDownloads(), downloads);
|
||||
startForeground(NOTIFICATION_ID, notification);
|
||||
onDownloadQueued(intent);
|
||||
} else if (numberOfDownloads.get() == 0) {
|
||||
stopSelf();
|
||||
} else {
|
||||
Log.d(TAG, "onStartCommand: Unknown intent");
|
||||
}
|
||||
return Service.START_NOT_STICKY;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue