ComponentCallbacks, ComponentCallbacks2public abstract class DownloadService extends Service
Service for downloading media.| Modifier and Type | Field | Description |
|---|---|---|
static String |
ACTION_ADD_DOWNLOAD |
Adds a new download.
|
static String |
ACTION_INIT |
Starts a download service to resume any ongoing downloads.
|
static String |
ACTION_PAUSE_DOWNLOADS |
Pauses all downloads.
|
static String |
ACTION_REMOVE_ALL_DOWNLOADS |
Removes all downloads.
|
static String |
ACTION_REMOVE_DOWNLOAD |
Removes a download.
|
static String |
ACTION_RESUME_DOWNLOADS |
Resumes all downloads except those that have a non-zero
Download.stopReason. |
static String |
ACTION_SET_REQUIREMENTS |
Sets the requirements that need to be met for downloads to progress.
|
static String |
ACTION_SET_STOP_REASON |
Sets the stop reason for one or all downloads.
|
static long |
DEFAULT_FOREGROUND_NOTIFICATION_UPDATE_INTERVAL |
Default foreground notification update interval in milliseconds.
|
static int |
FOREGROUND_NOTIFICATION_ID_NONE |
Invalid foreground notification id that can be used to run the service in the background.
|
static String |
KEY_CONTENT_ID |
|
static String |
KEY_DOWNLOAD_REQUEST |
Key for the
DownloadRequest in ACTION_ADD_DOWNLOAD intents. |
static String |
KEY_FOREGROUND |
Key for a boolean extra that can be set on any intent to indicate whether the service was
started in the foreground.
|
static String |
KEY_REQUIREMENTS |
Key for the
Requirements in ACTION_SET_REQUIREMENTS intents. |
static String |
KEY_STOP_REASON |
Key for the integer stop reason in
ACTION_SET_STOP_REASON and ACTION_ADD_DOWNLOAD intents. |
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDENACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_INCLUDE_CAPABILITIES, BIND_NOT_FOREGROUND, BIND_NOT_PERCEPTIBLE, BIND_WAIVE_PRIORITY, BIOMETRIC_SERVICE, BLOB_STORE_SERVICE, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_DIAGNOSTICS_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CROSS_PROFILE_APPS_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FILE_INTEGRITY_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, ROLE_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_IMS_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VPN_MANAGEMENT_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICESTART_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVE| Modifier | Constructor | Description |
|---|---|---|
protected |
DownloadService(int foregroundNotificationId) |
Creates a DownloadService.
|
protected |
DownloadService(int foregroundNotificationId,
long foregroundNotificationUpdateInterval) |
Creates a DownloadService.
|
protected |
DownloadService(int foregroundNotificationId,
long foregroundNotificationUpdateInterval,
String channelId,
int channelNameResourceId) |
Deprecated.
|
protected |
DownloadService(int foregroundNotificationId,
long foregroundNotificationUpdateInterval,
String channelId,
int channelNameResourceId,
int channelDescriptionResourceId) |
Creates a DownloadService.
|
| Modifier and Type | Method | Description |
|---|---|---|
static Intent |
buildAddDownloadIntent(Context context,
Class<? extends DownloadService> clazz,
DownloadRequest downloadRequest,
boolean foreground) |
Builds an
Intent for adding a new download. |
static Intent |
buildAddDownloadIntent(Context context,
Class<? extends DownloadService> clazz,
DownloadRequest downloadRequest,
int stopReason,
boolean foreground) |
Builds an
Intent for adding a new download. |
static Intent |
buildPauseDownloadsIntent(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Builds an
Intent to pause all downloads. |
static Intent |
buildRemoveAllDownloadsIntent(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Builds an
Intent for removing all downloads. |
static Intent |
buildRemoveDownloadIntent(Context context,
Class<? extends DownloadService> clazz,
String id,
boolean foreground) |
Builds an
Intent for removing the download with the id. |
static Intent |
buildResumeDownloadsIntent(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Builds an
Intent for resuming all downloads. |
static Intent |
buildSetRequirementsIntent(Context context,
Class<? extends DownloadService> clazz,
Requirements requirements,
boolean foreground) |
Builds an
Intent for setting the requirements that need to be met for downloads to
progress. |
static Intent |
buildSetStopReasonIntent(Context context,
Class<? extends DownloadService> clazz,
String id,
int stopReason,
boolean foreground) |
Builds an
Intent for setting the stop reason for one or all downloads. |
protected abstract DownloadManager |
getDownloadManager() |
Returns a
DownloadManager to be used to downloaded content. |
protected abstract Notification |
getForegroundNotification(List<Download> downloads) |
Returns a notification to be displayed when this service running in the foreground.
|
protected abstract Scheduler |
getScheduler() |
Returns a
Scheduler to restart the service when requirements allowing downloads to take
place are met. |
protected void |
invalidateForegroundNotification() |
Invalidates the current foreground notification and causes
getForegroundNotification(List) to be invoked again if the service isn't stopped. |
IBinder |
onBind(Intent intent) |
Throws
UnsupportedOperationException because this service is not designed to be bound. |
void |
onCreate() |
|
void |
onDestroy() |
|
protected void |
onDownloadChanged(Download download) |
Deprecated.
Some state change events may not be delivered to this method.
|
protected void |
onDownloadRemoved(Download download) |
Deprecated.
Some download removal events may not be delivered to this method.
|
int |
onStartCommand(Intent intent,
int flags,
int startId) |
|
void |
onTaskRemoved(Intent rootIntent) |
|
static void |
sendAddDownload(Context context,
Class<? extends DownloadService> clazz,
DownloadRequest downloadRequest,
boolean foreground) |
Starts the service if not started already and adds a new download.
|
static void |
sendAddDownload(Context context,
Class<? extends DownloadService> clazz,
DownloadRequest downloadRequest,
int stopReason,
boolean foreground) |
Starts the service if not started already and adds a new download.
|
static void |
sendPauseDownloads(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Starts the service if not started already and pauses all downloads.
|
static void |
sendRemoveAllDownloads(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Starts the service if not started already and removes all downloads.
|
static void |
sendRemoveDownload(Context context,
Class<? extends DownloadService> clazz,
String id,
boolean foreground) |
Starts the service if not started already and removes a download.
|
static void |
sendResumeDownloads(Context context,
Class<? extends DownloadService> clazz,
boolean foreground) |
Starts the service if not started already and resumes all downloads.
|
static void |
sendSetRequirements(Context context,
Class<? extends DownloadService> clazz,
Requirements requirements,
boolean foreground) |
Starts the service if not started already and sets the requirements that need to be met for
downloads to progress.
|
static void |
sendSetStopReason(Context context,
Class<? extends DownloadService> clazz,
String id,
int stopReason,
boolean foreground) |
Starts the service if not started already and sets the stop reason for one or all downloads.
|
static void |
start(Context context,
Class<? extends DownloadService> clazz) |
Starts a download service to resume any ongoing downloads.
|
static void |
startForeground(Context context,
Class<? extends DownloadService> clazz) |
Starts the service in the foreground without adding a new download request.
|
getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, sendBroadcastWithMultiplePermissions, unregisterComponentCallbacksbindIsolatedService, bindService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createAttributionContext, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver, updateServiceGroupclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitattachBaseContext, dump, getApplication, getForegroundServiceType, onConfigurationChanged, onLowMemory, onRebind, onStart, onTrimMemory, onUnbind, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResultpublic static final String ACTION_INIT
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_ADD_DOWNLOAD
KEY_DOWNLOAD_REQUEST - A DownloadRequest defining the download to be
added.
KEY_STOP_REASON - An initial stop reason for the download. If omitted Download.STOP_REASON_NONE is used.
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_REMOVE_DOWNLOAD
KEY_CONTENT_ID - The content id of a download to remove.
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_REMOVE_ALL_DOWNLOADS
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_RESUME_DOWNLOADS
Download.stopReason. Extras:
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_PAUSE_DOWNLOADS
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_SET_STOP_REASON
Download.STOP_REASON_NONE. Extras:
KEY_CONTENT_ID - The content id of a single download to update with the stop
reason. If omitted, all downloads will be updated.
KEY_STOP_REASON - An application provided reason for stopping the download or
downloads, or Download.STOP_REASON_NONE to clear the stop reason.
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String ACTION_SET_REQUIREMENTS
KEY_REQUIREMENTS - A Requirements.
KEY_FOREGROUND - See KEY_FOREGROUND.
public static final String KEY_DOWNLOAD_REQUEST
DownloadRequest in ACTION_ADD_DOWNLOAD intents.public static final String KEY_CONTENT_ID
public static final String KEY_STOP_REASON
ACTION_SET_STOP_REASON and ACTION_ADD_DOWNLOAD intents.public static final String KEY_REQUIREMENTS
Requirements in ACTION_SET_REQUIREMENTS intents.public static final String KEY_FOREGROUND
Service.startForeground(int, Notification).public static final int FOREGROUND_NOTIFICATION_ID_NONE
public static final long DEFAULT_FOREGROUND_NOTIFICATION_UPDATE_INTERVAL
protected DownloadService(int foregroundNotificationId)
If foregroundNotificationId is FOREGROUND_NOTIFICATION_ID_NONE then the
service will only ever run in the background. No foreground notification will be displayed and
getScheduler() will not be called.
If foregroundNotificationId is not FOREGROUND_NOTIFICATION_ID_NONE then the
service will run in the foreground. The foreground notification will be updated at least as
often as the interval specified by DEFAULT_FOREGROUND_NOTIFICATION_UPDATE_INTERVAL.
foregroundNotificationId - The notification id for the foreground notification, or FOREGROUND_NOTIFICATION_ID_NONE if the service should only ever run in the background.protected DownloadService(int foregroundNotificationId,
long foregroundNotificationUpdateInterval)
foregroundNotificationId - The notification id for the foreground notification, or FOREGROUND_NOTIFICATION_ID_NONE if the service should only ever run in the background.foregroundNotificationUpdateInterval - The maximum interval between updates to the
foreground notification, in milliseconds. Ignored if foregroundNotificationId is
FOREGROUND_NOTIFICATION_ID_NONE.@Deprecated protected DownloadService(int foregroundNotificationId, long foregroundNotificationUpdateInterval, @Nullable String channelId, @StringRes int channelNameResourceId)
protected DownloadService(int foregroundNotificationId,
long foregroundNotificationUpdateInterval,
@Nullable
String channelId,
@StringRes
int channelNameResourceId,
@StringRes
int channelDescriptionResourceId)
foregroundNotificationId - The notification id for the foreground notification, or FOREGROUND_NOTIFICATION_ID_NONE if the service should only ever run in the background.foregroundNotificationUpdateInterval - The maximum interval between updates to the
foreground notification, in milliseconds. Ignored if foregroundNotificationId is
FOREGROUND_NOTIFICATION_ID_NONE.channelId - An id for a low priority notification channel to create, or null if
the app will take care of creating a notification channel if needed. If specified, must be
unique per package. The value may be truncated if it's too long. Ignored if
foregroundNotificationId is FOREGROUND_NOTIFICATION_ID_NONE.channelNameResourceId - A string resource identifier for the user visible name of the
notification channel. The recommended maximum length is 40 characters. The value may be
truncated if it's too long. Ignored if channelId is null or if
foregroundNotificationId is FOREGROUND_NOTIFICATION_ID_NONE.channelDescriptionResourceId - A string resource identifier for the user visible
description of the notification channel, or 0 if no description is provided. The
recommended maximum length is 300 characters. The value may be truncated if it is too long.
Ignored if channelId is null or if foregroundNotificationId is FOREGROUND_NOTIFICATION_ID_NONE.public static Intent buildAddDownloadIntent(Context context, Class<? extends DownloadService> clazz, DownloadRequest downloadRequest, boolean foreground)
Intent for adding a new download.context - A Context.clazz - The concrete download service being targeted by the intent.downloadRequest - The request to be executed.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildAddDownloadIntent(Context context, Class<? extends DownloadService> clazz, DownloadRequest downloadRequest, int stopReason, boolean foreground)
Intent for adding a new download.context - A Context.clazz - The concrete download service being targeted by the intent.downloadRequest - The request to be executed.stopReason - An initial stop reason for the download, or Download.STOP_REASON_NONE
if the download should be started.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildRemoveDownloadIntent(Context context, Class<? extends DownloadService> clazz, String id, boolean foreground)
Intent for removing the download with the id.context - A Context.clazz - The concrete download service being targeted by the intent.id - The content id.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildRemoveAllDownloadsIntent(Context context, Class<? extends DownloadService> clazz, boolean foreground)
Intent for removing all downloads.context - A Context.clazz - The concrete download service being targeted by the intent.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildResumeDownloadsIntent(Context context, Class<? extends DownloadService> clazz, boolean foreground)
Intent for resuming all downloads.context - A Context.clazz - The concrete download service being targeted by the intent.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildPauseDownloadsIntent(Context context, Class<? extends DownloadService> clazz, boolean foreground)
Intent to pause all downloads.context - A Context.clazz - The concrete download service being targeted by the intent.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildSetStopReasonIntent(Context context, Class<? extends DownloadService> clazz, @Nullable String id, int stopReason, boolean foreground)
Intent for setting the stop reason for one or all downloads. To clear the
stop reason, pass Download.STOP_REASON_NONE.context - A Context.clazz - The concrete download service being targeted by the intent.id - The content id, or null to set the stop reason for all downloads.stopReason - An application defined stop reason.foreground - Whether this intent will be used to start the service in the foreground.public static Intent buildSetRequirementsIntent(Context context, Class<? extends DownloadService> clazz, Requirements requirements, boolean foreground)
Intent for setting the requirements that need to be met for downloads to
progress.context - A Context.clazz - The concrete download service being targeted by the intent.requirements - A Requirements.foreground - Whether this intent will be used to start the service in the foreground.public static void sendAddDownload(Context context, Class<? extends DownloadService> clazz, DownloadRequest downloadRequest, boolean foreground)
context - A Context.clazz - The concrete download service to be started.downloadRequest - The request to be executed.foreground - Whether the service is started in the foreground.public static void sendAddDownload(Context context, Class<? extends DownloadService> clazz, DownloadRequest downloadRequest, int stopReason, boolean foreground)
context - A Context.clazz - The concrete download service to be started.downloadRequest - The request to be executed.stopReason - An initial stop reason for the download, or Download.STOP_REASON_NONE
if the download should be started.foreground - Whether the service is started in the foreground.public static void sendRemoveDownload(Context context, Class<? extends DownloadService> clazz, String id, boolean foreground)
context - A Context.clazz - The concrete download service to be started.id - The content id.foreground - Whether the service is started in the foreground.public static void sendRemoveAllDownloads(Context context, Class<? extends DownloadService> clazz, boolean foreground)
context - A Context.clazz - The concrete download service to be started.foreground - Whether the service is started in the foreground.public static void sendResumeDownloads(Context context, Class<? extends DownloadService> clazz, boolean foreground)
context - A Context.clazz - The concrete download service to be started.foreground - Whether the service is started in the foreground.public static void sendPauseDownloads(Context context, Class<? extends DownloadService> clazz, boolean foreground)
context - A Context.clazz - The concrete download service to be started.foreground - Whether the service is started in the foreground.public static void sendSetStopReason(Context context, Class<? extends DownloadService> clazz, @Nullable String id, int stopReason, boolean foreground)
Download.STOP_REASON_NONE.context - A Context.clazz - The concrete download service to be started.id - The content id, or null to set the stop reason for all downloads.stopReason - An application defined stop reason.foreground - Whether the service is started in the foreground.public static void sendSetRequirements(Context context, Class<? extends DownloadService> clazz, Requirements requirements, boolean foreground)
context - A Context.clazz - The concrete download service to be started.requirements - A Requirements.foreground - Whether the service is started in the foreground.public static void start(Context context, Class<? extends DownloadService> clazz)
context - A Context.clazz - The concrete download service to be started.startForeground(Context, Class)public static void startForeground(Context context, Class<? extends DownloadService> clazz)
context - A Context.clazz - The concrete download service to be started.start(Context, Class)public int onStartCommand(@Nullable
Intent intent,
int flags,
int startId)
onStartCommand in class Servicepublic void onTaskRemoved(Intent rootIntent)
onTaskRemoved in class Service@Nullable public final IBinder onBind(Intent intent)
UnsupportedOperationException because this service is not designed to be bound.protected abstract DownloadManager getDownloadManager()
DownloadManager to be used to downloaded content. Called only once in the
life cycle of the process.@Nullable protected abstract Scheduler getScheduler()
Scheduler to restart the service when requirements allowing downloads to take
place are met. If null, the service will only be restarted if the process is still in
memory when the requirements are met.
This method is not called for services whose foregroundNotificationId is set to
FOREGROUND_NOTIFICATION_ID_NONE. Such services will only be restarted if the process
is still in memory and considered non-idle, meaning that it's either in the foreground or was
backgrounded within the last few minutes.
protected abstract Notification getForegroundNotification(List<Download> downloads)
Download services that do not wish to run in the foreground should be created by setting the
foregroundNotificationId constructor argument to FOREGROUND_NOTIFICATION_ID_NONE. This method is not called for such services, meaning it can
be implemented to throw UnsupportedOperationException.
downloads - The current downloads.protected final void invalidateForegroundNotification()
getForegroundNotification(List) to be invoked again if the service isn't stopped.@Deprecated protected void onDownloadChanged(Download download)
DownloadManager.addListener(DownloadManager.Listener) to register a listener directly to
the DownloadManager that you return through getDownloadManager().@Deprecated protected void onDownloadRemoved(Download download)
DownloadManager.addListener(DownloadManager.Listener) to register a listener
directly to the DownloadManager that you return through getDownloadManager().