# DownloadManager

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/app/DownloadManager#nestedclasses)\|[Constants](https://developer.android.com/reference/android/app/DownloadManager#constants)\|[Methods](https://developer.android.com/reference/android/app/DownloadManager#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/DownloadManager#inhmethods)  

# DownloadManager

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/DownloadManager "View this page in Kotlin")\|Java

`
public


class
DownloadManager
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.DownloadManager |

<br />

*** ** * ** ***

The download manager is a system service that handles long-running HTTP downloads. Clients may request that a URI be downloaded to a particular destination file. The download manager will conduct the download in the background, taking care of HTTP interactions and retrying downloads after failures or across connectivity changes and system reboots.

Apps that request downloads through this API should register a broadcast receiver for[ACTION_NOTIFICATION_CLICKED](https://developer.android.com/reference/android/app/DownloadManager#ACTION_NOTIFICATION_CLICKED)to appropriately handle when the user clicks on a running download in a notification or from the downloads UI.

Note that the application must have the[Manifest.permission.INTERNET](https://developer.android.com/reference/android/Manifest.permission#INTERNET)permission to use this class.

## Summary

|                                                                                      ### Nested classes                                                                                       ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [DownloadManager.Query](https://developer.android.com/reference/android/app/DownloadManager.Query) This class may be used to filter download manager queries.                       |
| ` class` | [DownloadManager.Request](https://developer.android.com/reference/android/app/DownloadManager.Request) This class contains all the information necessary to request a new download. |

|                                                                                                                                                                                                                          ### Constants                                                                                                                                                                                                                           ||
|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_DOWNLOAD_COMPLETE](https://developer.android.com/reference/android/app/DownloadManager#ACTION_DOWNLOAD_COMPLETE) Broadcast intent action sent by the download manager when a download completes.                                                                                                                                                                                     |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_NOTIFICATION_CLICKED](https://developer.android.com/reference/android/app/DownloadManager#ACTION_NOTIFICATION_CLICKED) Broadcast intent action sent by the download manager when the user clicks on a running download, either from a system notification or from the downloads UI.                                                                                                  |
| [String](https://developer.android.com/reference/java/lang/String) | [ACTION_VIEW_DOWNLOADS](https://developer.android.com/reference/android/app/DownloadManager#ACTION_VIEW_DOWNLOADS) Intent action to launch an activity to display all downloads.                                                                                                                                                                                                             |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_BYTES_DOWNLOADED_SO_FAR](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_BYTES_DOWNLOADED_SO_FAR) Number of bytes download so far.                                                                                                                                                                                                                        |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_DESCRIPTION](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_DESCRIPTION) The client-supplied description of this download.                                                                                                                                                                                                                               |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_ID](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_ID) An identifier for a particular download, unique across the system.                                                                                                                                                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_LAST_MODIFIED_TIMESTAMP](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_LAST_MODIFIED_TIMESTAMP) Timestamp when the download was last modified, in[System.currentTimeMillis()](https://developer.android.com/reference/java/lang/System#currentTimeMillis())(wall clock time in UTC).                                                                    |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_LOCAL_FILENAME](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_LOCAL_FILENAME) *This constant was deprecated in API level 24. apps should transition to using[ContentResolver.openFileDescriptor(Uri, String)](https://developer.android.com/reference/android/content/ContentResolver#openFileDescriptor(android.net.Uri,%20java.lang.String))instead.* |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_LOCAL_URI](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_LOCAL_URI) Uri where downloaded file will be stored.                                                                                                                                                                                                                                           |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_MEDIAPROVIDER_URI](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_MEDIAPROVIDER_URI) The URI to the corresponding entry in MediaProvider for this downloaded entry.                                                                                                                                                                                      |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_MEDIA_TYPE](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_MEDIA_TYPE) Internet Media Type of the downloaded file.                                                                                                                                                                                                                                       |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON) Provides more detail on the status of the download.                                                                                                                                                                                                                                       |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS) Current status of the download, as one of the STATUS_\* constants.                                                                                                                                                                                                                        |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_TITLE](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_TITLE) The client-supplied title for this download.                                                                                                                                                                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_TOTAL_SIZE_BYTES](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_TOTAL_SIZE_BYTES) Total size of the download in bytes.                                                                                                                                                                                                                                  |
| [String](https://developer.android.com/reference/java/lang/String) | [COLUMN_URI](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_URI) URI to be downloaded.                                                                                                                                                                                                                                                                           |
| `int`                                                              | [ERROR_CANNOT_RESUME](https://developer.android.com/reference/android/app/DownloadManager#ERROR_CANNOT_RESUME) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when some possibly transient error occurred but we can't resume the download.                                                                                       |
| `int`                                                              | [ERROR_DEVICE_NOT_FOUND](https://developer.android.com/reference/android/app/DownloadManager#ERROR_DEVICE_NOT_FOUND) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when no external storage device was found.                                                                                                                    |
| `int`                                                              | [ERROR_FILE_ALREADY_EXISTS](https://developer.android.com/reference/android/app/DownloadManager#ERROR_FILE_ALREADY_EXISTS) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the requested destination file already exists (the download manager will not overwrite an existing file).                                          |
| `int`                                                              | [ERROR_FILE_ERROR](https://developer.android.com/reference/android/app/DownloadManager#ERROR_FILE_ERROR) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when a storage issue arises which doesn't fit under any other error code.                                                                                                 |
| `int`                                                              | [ERROR_HTTP_DATA_ERROR](https://developer.android.com/reference/android/app/DownloadManager#ERROR_HTTP_DATA_ERROR) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when an error receiving or processing data occurred at the HTTP level.                                                                                          |
| `int`                                                              | [ERROR_INSUFFICIENT_SPACE](https://developer.android.com/reference/android/app/DownloadManager#ERROR_INSUFFICIENT_SPACE) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when there was insufficient storage space.                                                                                                                |
| `int`                                                              | [ERROR_TOO_MANY_REDIRECTS](https://developer.android.com/reference/android/app/DownloadManager#ERROR_TOO_MANY_REDIRECTS) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when there were too many redirects.                                                                                                                       |
| `int`                                                              | [ERROR_UNHANDLED_HTTP_CODE](https://developer.android.com/reference/android/app/DownloadManager#ERROR_UNHANDLED_HTTP_CODE) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when an HTTP code was received that download manager can't handle.                                                                                      |
| `int`                                                              | [ERROR_UNKNOWN](https://developer.android.com/reference/android/app/DownloadManager#ERROR_UNKNOWN) Value of COLUMN_ERROR_CODE when the download has completed with an error that doesn't fit under any other error code.                                                                                                                                                                     |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_DOWNLOAD_ID](https://developer.android.com/reference/android/app/DownloadManager#EXTRA_DOWNLOAD_ID) Intent extra included with[ACTION_DOWNLOAD_COMPLETE](https://developer.android.com/reference/android/app/DownloadManager#ACTION_DOWNLOAD_COMPLETE)intents, indicating the ID (as a long) of the download that just completed.                                                     |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS](https://developer.android.com/reference/android/app/DownloadManager#EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS) When clicks on multiple notifications are received, the following provides an array of download ids corresponding to the download notification that was clicked.                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [INTENT_EXTRAS_SORT_BY_SIZE](https://developer.android.com/reference/android/app/DownloadManager#INTENT_EXTRAS_SORT_BY_SIZE) Intent extra included with[ACTION_VIEW_DOWNLOADS](https://developer.android.com/reference/android/app/DownloadManager#ACTION_VIEW_DOWNLOADS)to start DownloadApp in sort-by-size mode.                                                                          |
| `int`                                                              | [PAUSED_QUEUED_FOR_WIFI](https://developer.android.com/reference/android/app/DownloadManager#PAUSED_QUEUED_FOR_WIFI) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download exceeds a size limit for downloads over the mobile network and the download manager is waiting for a Wi-Fi connection to proceed.           |
| `int`                                                              | [PAUSED_UNKNOWN](https://developer.android.com/reference/android/app/DownloadManager#PAUSED_UNKNOWN) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is paused for some other reason.                                                                                                                            |
| `int`                                                              | [PAUSED_WAITING_FOR_NETWORK](https://developer.android.com/reference/android/app/DownloadManager#PAUSED_WAITING_FOR_NETWORK) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is waiting for network connectivity to proceed.                                                                                     |
| `int`                                                              | [PAUSED_WAITING_TO_RETRY](https://developer.android.com/reference/android/app/DownloadManager#PAUSED_WAITING_TO_RETRY) Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is paused because some network error occurred and the download manager is waiting before retrying the request.                            |
| `int`                                                              | [STATUS_FAILED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_FAILED) Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download has failed (and will not be retried).                                                                                                                         |
| `int`                                                              | [STATUS_PAUSED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_PAUSED) Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is waiting to retry or resume.                                                                                                                                |
| `int`                                                              | [STATUS_PENDING](https://developer.android.com/reference/android/app/DownloadManager#STATUS_PENDING) Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is waiting to start.                                                                                                                                        |
| `int`                                                              | [STATUS_RUNNING](https://developer.android.com/reference/android/app/DownloadManager#STATUS_RUNNING) Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is currently running.                                                                                                                                       |
| `int`                                                              | [STATUS_SUCCESSFUL](https://developer.android.com/reference/android/app/DownloadManager#STATUS_SUCCESSFUL) Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download has successfully completed.                                                                                                                           |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` long`                                                                                            | ` `[addCompletedDownload](https://developer.android.com/reference/android/app/DownloadManager#addCompletedDownload(java.lang.String,%20java.lang.String,%20boolean,%20java.lang.String,%20java.lang.String,%20long,%20boolean))`(`[String](https://developer.android.com/reference/java/lang/String)` title, `[String](https://developer.android.com/reference/java/lang/String)` description, boolean isMediaScannerScannable, `[String](https://developer.android.com/reference/java/lang/String)` mimeType, `[String](https://developer.android.com/reference/java/lang/String)` path, long length, boolean showNotification) ` *This method was deprecated in API level 29. Apps should instead contribute files to[MediaStore.Downloads](https://developer.android.com/reference/android/provider/MediaStore.Downloads)collection to make them available to user as part of Downloads.*                                                                                                                                                                                       |
| ` long`                                                                                            | ` `[addCompletedDownload](https://developer.android.com/reference/android/app/DownloadManager#addCompletedDownload(java.lang.String,%20java.lang.String,%20boolean,%20java.lang.String,%20java.lang.String,%20long,%20boolean,%20android.net.Uri,%20android.net.Uri))`(`[String](https://developer.android.com/reference/java/lang/String)` title, `[String](https://developer.android.com/reference/java/lang/String)` description, boolean isMediaScannerScannable, `[String](https://developer.android.com/reference/java/lang/String)` mimeType, `[String](https://developer.android.com/reference/java/lang/String)` path, long length, boolean showNotification, `[Uri](https://developer.android.com/reference/android/net/Uri)` uri, `[Uri](https://developer.android.com/reference/android/net/Uri)` referer) ` *This method was deprecated in API level 29. Apps should instead contribute files to[MediaStore.Downloads](https://developer.android.com/reference/android/provider/MediaStore.Downloads)collection to make them available to user as part of Downloads.* |
| ` long`                                                                                            | ` `[enqueue](https://developer.android.com/reference/android/app/DownloadManager#enqueue(android.app.DownloadManager.Request))`(`[DownloadManager.Request](https://developer.android.com/reference/android/app/DownloadManager.Request)` request) ` Enqueue a new download.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` static `[Long](https://developer.android.com/reference/java/lang/Long)                           | ` `[getMaxBytesOverMobile](https://developer.android.com/reference/android/app/DownloadManager#getMaxBytesOverMobile(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context)` context) ` Returns maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no limit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` `[String](https://developer.android.com/reference/java/lang/String)                              | ` `[getMimeTypeForDownloadedFile](https://developer.android.com/reference/android/app/DownloadManager#getMimeTypeForDownloadedFile(long))`(long id) ` Returns the media type of the given downloaded file id, if the file was downloaded successfully.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` static `[Long](https://developer.android.com/reference/java/lang/Long)                           | ` `[getRecommendedMaxBytesOverMobile](https://developer.android.com/reference/android/app/DownloadManager#getRecommendedMaxBytesOverMobile(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context)` context) ` Returns recommended maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no recommended limit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[Uri](https://developer.android.com/reference/android/net/Uri)                                  | ` `[getUriForDownloadedFile](https://developer.android.com/reference/android/app/DownloadManager#getUriForDownloadedFile(long))`(long id) ` Returns the[Uri](https://developer.android.com/reference/android/net/Uri)of the given downloaded file id, if the file is downloaded successfully.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[ParcelFileDescriptor](https://developer.android.com/reference/android/os/ParcelFileDescriptor) | ` `[openDownloadedFile](https://developer.android.com/reference/android/app/DownloadManager#openDownloadedFile(long))`(long id) ` Open a downloaded file for reading.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` `[Cursor](https://developer.android.com/reference/android/database/Cursor)                       | ` `[query](https://developer.android.com/reference/android/app/DownloadManager#query(android.app.DownloadManager.Query))`(`[DownloadManager.Query](https://developer.android.com/reference/android/app/DownloadManager.Query)` query) ` Query the download manager about downloads that have been requested.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` int`                                                                                             | ` `[remove](https://developer.android.com/reference/android/app/DownloadManager#remove(long[]))`(long... ids) ` Cancel downloads and remove them from the download manager.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### ACTION_DOWNLOAD_COMPLETE

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_DOWNLOAD_COMPLETE
```

Broadcast intent action sent by the download manager when a download completes.

<br />

Constant Value: "android.intent.action.DOWNLOAD_COMPLETE"  

### ACTION_NOTIFICATION_CLICKED

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_NOTIFICATION_CLICKED
```

Broadcast intent action sent by the download manager when the user clicks on a running download, either from a system notification or from the downloads UI.

<br />

Constant Value: "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"  

### ACTION_VIEW_DOWNLOADS

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String ACTION_VIEW_DOWNLOADS
```

Intent action to launch an activity to display all downloads.

<br />

Constant Value: "android.intent.action.VIEW_DOWNLOADS"  

### COLUMN_BYTES_DOWNLOADED_SO_FAR

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_BYTES_DOWNLOADED_SO_FAR
```

Number of bytes download so far.

<br />

Constant Value: "bytes_so_far"  

### COLUMN_DESCRIPTION

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_DESCRIPTION
```

The client-supplied description of this download. This will be displayed in system notifications. Defaults to the empty string.

<br />

Constant Value: "description"  

### COLUMN_ID

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_ID
```

An identifier for a particular download, unique across the system. Clients use this ID to make subsequent calls related to the download.

<br />

Constant Value: "_id"  

### COLUMN_LAST_MODIFIED_TIMESTAMP

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_LAST_MODIFIED_TIMESTAMP
```

Timestamp when the download was last modified, in[System.currentTimeMillis()](https://developer.android.com/reference/java/lang/System#currentTimeMillis())(wall clock time in UTC).

<br />

Constant Value: "last_modified_timestamp"  

### COLUMN_LOCAL_FILENAME

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_LOCAL_FILENAME
```

<br />

**This constant was deprecated in API level 24.**   
apps should transition to using[ContentResolver.openFileDescriptor(Uri, String)](https://developer.android.com/reference/android/content/ContentResolver#openFileDescriptor(android.net.Uri,%20java.lang.String))instead.

Path to the downloaded file on disk.

Note that apps may not have filesystem permissions to directly access this path. Instead of trying to open this path directly, apps should use[ContentResolver.openFileDescriptor(Uri, String)](https://developer.android.com/reference/android/content/ContentResolver#openFileDescriptor(android.net.Uri,%20java.lang.String))to gain access.

<br />

Constant Value: "local_filename"  

### COLUMN_LOCAL_URI

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_LOCAL_URI
```

Uri where downloaded file will be stored. If a destination is supplied by client, that URI will be used here. Otherwise, the value will initially be null and will be filled in with a generated URI once the download has started.

<br />

Constant Value: "local_uri"  

### COLUMN_MEDIAPROVIDER_URI

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_MEDIAPROVIDER_URI
```

The URI to the corresponding entry in MediaProvider for this downloaded entry. It is used to delete the entries from MediaProvider database when it is deleted from the downloaded list.

<br />

Constant Value: "mediaprovider_uri"  

### COLUMN_MEDIA_TYPE

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_MEDIA_TYPE
```

Internet Media Type of the downloaded file. If no value is provided upon creation, this will initially be null and will be filled in based on the server's response once the download has started.

<br />

**See also:**

- [RFC 1590, defining Media Types](http://www.ietf.org/rfc/rfc1590.txt)

Constant Value: "media_type"  

### COLUMN_REASON

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_REASON
```

Provides more detail on the status of the download. Its meaning depends on the value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS). When[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)is[STATUS_FAILED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_FAILED), this indicates the type of error that occurred. If an HTTP error occurred, this will hold the HTTP status code as defined in RFC 2616. Otherwise, it will hold one of the ERROR_\* constants. When[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)is[STATUS_PAUSED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_PAUSED), this indicates why the download is paused. It will hold one of the PAUSED_\* constants. If[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)is neither[STATUS_FAILED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_FAILED)nor[STATUS_PAUSED](https://developer.android.com/reference/android/app/DownloadManager#STATUS_PAUSED), this column's value is undefined.

<br />

**See also:**

- [RFC 2616 status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1)

Constant Value: "reason"  

### COLUMN_STATUS

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_STATUS
```

Current status of the download, as one of the STATUS_\* constants.

<br />

Constant Value: "status"  

### COLUMN_TITLE

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_TITLE
```

The client-supplied title for this download. This will be displayed in system notifications. Defaults to the empty string.

<br />

Constant Value: "title"  

### COLUMN_TOTAL_SIZE_BYTES

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_TOTAL_SIZE_BYTES
```

Total size of the download in bytes. This will initially be -1 and will be filled in once the download starts.

<br />

Constant Value: "total_size"  

### COLUMN_URI

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String COLUMN_URI
```

URI to be downloaded.

<br />

Constant Value: "uri"  

### ERROR_CANNOT_RESUME

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_CANNOT_RESUME
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when some possibly transient error occurred but we can't resume the download.

<br />

Constant Value: 1008 (0x000003f0)  

### ERROR_DEVICE_NOT_FOUND

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_DEVICE_NOT_FOUND
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when no external storage device was found. Typically, this is because the SD card is not mounted.

<br />

Constant Value: 1007 (0x000003ef)  

### ERROR_FILE_ALREADY_EXISTS

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_FILE_ALREADY_EXISTS
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the requested destination file already exists (the download manager will not overwrite an existing file).

<br />

Constant Value: 1009 (0x000003f1)  

### ERROR_FILE_ERROR

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_FILE_ERROR
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when a storage issue arises which doesn't fit under any other error code. Use the more specific[ERROR_INSUFFICIENT_SPACE](https://developer.android.com/reference/android/app/DownloadManager#ERROR_INSUFFICIENT_SPACE)and[ERROR_DEVICE_NOT_FOUND](https://developer.android.com/reference/android/app/DownloadManager#ERROR_DEVICE_NOT_FOUND)when appropriate.

<br />

Constant Value: 1001 (0x000003e9)  

### ERROR_HTTP_DATA_ERROR

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_HTTP_DATA_ERROR
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when an error receiving or processing data occurred at the HTTP level.

<br />

Constant Value: 1004 (0x000003ec)  

### ERROR_INSUFFICIENT_SPACE

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_INSUFFICIENT_SPACE
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when there was insufficient storage space. Typically, this is because the SD card is full.

<br />

Constant Value: 1006 (0x000003ee)  

### ERROR_TOO_MANY_REDIRECTS

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_TOO_MANY_REDIRECTS
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when there were too many redirects.

<br />

Constant Value: 1005 (0x000003ed)  

### ERROR_UNHANDLED_HTTP_CODE

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_UNHANDLED_HTTP_CODE
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when an HTTP code was received that download manager can't handle.

<br />

Constant Value: 1002 (0x000003ea)  

### ERROR_UNKNOWN

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int ERROR_UNKNOWN
```

Value of COLUMN_ERROR_CODE when the download has completed with an error that doesn't fit under any other error code.

<br />

Constant Value: 1000 (0x000003e8)  

### EXTRA_DOWNLOAD_ID

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_DOWNLOAD_ID
```

Intent extra included with[ACTION_DOWNLOAD_COMPLETE](https://developer.android.com/reference/android/app/DownloadManager#ACTION_DOWNLOAD_COMPLETE)intents, indicating the ID (as a long) of the download that just completed.

<br />

Constant Value: "extra_download_id"  

### EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS
```

When clicks on multiple notifications are received, the following provides an array of download ids corresponding to the download notification that was clicked. It can be retrieved by the receiver of this Intent using[Intent.getLongArrayExtra(String)](https://developer.android.com/reference/android/content/Intent#getLongArrayExtra(java.lang.String)).

<br />

Constant Value: "extra_click_download_ids"  

### INTENT_EXTRAS_SORT_BY_SIZE

Added in[API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final String INTENT_EXTRAS_SORT_BY_SIZE
```

Intent extra included with[ACTION_VIEW_DOWNLOADS](https://developer.android.com/reference/android/app/DownloadManager#ACTION_VIEW_DOWNLOADS)to start DownloadApp in sort-by-size mode.

<br />

Constant Value: "android.app.DownloadManager.extra_sortBySize"  

### PAUSED_QUEUED_FOR_WIFI

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PAUSED_QUEUED_FOR_WIFI
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download exceeds a size limit for downloads over the mobile network and the download manager is waiting for a Wi-Fi connection to proceed.

<br />

Constant Value: 3 (0x00000003)  

### PAUSED_UNKNOWN

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PAUSED_UNKNOWN
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is paused for some other reason.

<br />

Constant Value: 4 (0x00000004)  

### PAUSED_WAITING_FOR_NETWORK

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PAUSED_WAITING_FOR_NETWORK
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is waiting for network connectivity to proceed.

<br />

Constant Value: 2 (0x00000002)  

### PAUSED_WAITING_TO_RETRY

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int PAUSED_WAITING_TO_RETRY
```

Value of[COLUMN_REASON](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_REASON)when the download is paused because some network error occurred and the download manager is waiting before retrying the request.

<br />

Constant Value: 1 (0x00000001)  

### STATUS_FAILED

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_FAILED
```

Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download has failed (and will not be retried).

<br />

Constant Value: 16 (0x00000010)  

### STATUS_PAUSED

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_PAUSED
```

Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is waiting to retry or resume.

<br />

Constant Value: 4 (0x00000004)  

### STATUS_PENDING

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_PENDING
```

Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is waiting to start.

<br />

Constant Value: 1 (0x00000001)  

### STATUS_RUNNING

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_RUNNING
```

Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download is currently running.

<br />

Constant Value: 2 (0x00000002)  

### STATUS_SUCCESSFUL

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static final int STATUS_SUCCESSFUL
```

Value of[COLUMN_STATUS](https://developer.android.com/reference/android/app/DownloadManager#COLUMN_STATUS)when the download has successfully completed.

<br />

Constant Value: 8 (0x00000008)

## Public methods

### addCompletedDownload

Added in[API level 12](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long addCompletedDownload (String title, 
                String description, 
                boolean isMediaScannerScannable, 
                String mimeType, 
                String path, 
                long length, 
                boolean showNotification)
```

<br />

**This method was deprecated in API level 29.**   
Apps should instead contribute files to[MediaStore.Downloads](https://developer.android.com/reference/android/provider/MediaStore.Downloads)collection to make them available to user as part of Downloads.

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

It is helpful to make the file scannable by MediaScanner by setting the param isMediaScannerScannable to true. It makes the file visible in media managing applications such as Gallery App, which could be a useful purpose of using this API.

For applications targeting[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q)or above,`path`must be within directories owned by the application {e.g.[Context.getExternalFilesDir(String)](https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String))} or if the application is running under the legacy storage model (see[android:requestLegacyExternalStorage](https://developer.android.com/reference/android/R.styleable#AndroidManifestApplication_requestLegacyExternalStorage)),`path`can also be within the top-level Downloads directory (as returned by[Environment.getExternalStoragePublicDirectory(String)](https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String))with[Environment.DIRECTORY_DOWNLOADS](https://developer.android.com/reference/android/os/Environment#DIRECTORY_DOWNLOADS)).

<br />

|                                                                                                                                              Parameters                                                                                                                                              ||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `title`                   | `String`: the title that would appear for this file in Downloads App. <br />                                                                                                                                                                                              |
| `description`             | `String`: the description that would appear for this file in Downloads App. <br />                                                                                                                                                                                        |
| `isMediaScannerScannable` | `boolean`: true if the file is to be scanned by MediaScanner. Files scanned by MediaScanner appear in the applications used to view media (for example, Gallery app). <br />                                                                                              |
| `mimeType`                | `String`: mimetype of the file. <br />                                                                                                                                                                                                                                    |
| `path`                    | `String`: absolute pathname to the file. The file should be world-readable, so that it can be managed by the Downloads App and any other app that is used to read it (for example, Gallery app to display the file, if the file contents represent a video/image). <br /> |
| `length`                  | `long`: length of the downloaded file <br />                                                                                                                                                                                                                              |
| `showNotification`        | `boolean`: true if a notification is to be sent, false otherwise <br />                                                                                                                                                                                                   |

|                                                                             Returns                                                                             ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | an ID for the download entry added to the downloads app, unique across the system This ID is used to make future calls related to this download. <br /> |

### addCompletedDownload

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long addCompletedDownload (String title, 
                String description, 
                boolean isMediaScannerScannable, 
                String mimeType, 
                String path, 
                long length, 
                boolean showNotification, 
                Uri uri, 
                Uri referer)
```

<br />

**This method was deprecated in API level 29.**   
Apps should instead contribute files to[MediaStore.Downloads](https://developer.android.com/reference/android/provider/MediaStore.Downloads)collection to make them available to user as part of Downloads.

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

It is helpful to make the file scannable by MediaScanner by setting the param isMediaScannerScannable to true. It makes the file visible in media managing applications such as Gallery App, which could be a useful purpose of using this API.

For applications targeting[Build.VERSION_CODES.Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q)or above,`path`must be within directories owned by the application {e.g.[Context.getExternalFilesDir(String)](https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String))} or if the application is running under the legacy storage model (see[android:requestLegacyExternalStorage](https://developer.android.com/reference/android/R.styleable#AndroidManifestApplication_requestLegacyExternalStorage)),`path`can also be within the top-level Downloads directory (as returned by[Environment.getExternalStoragePublicDirectory(String)](https://developer.android.com/reference/android/os/Environment#getExternalStoragePublicDirectory(java.lang.String))with[Environment.DIRECTORY_DOWNLOADS](https://developer.android.com/reference/android/os/Environment#DIRECTORY_DOWNLOADS)).

<br />

|                                                                                                                                              Parameters                                                                                                                                              ||
|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `title`                   | `String`: the title that would appear for this file in Downloads App. <br />                                                                                                                                                                                              |
| `description`             | `String`: the description that would appear for this file in Downloads App. <br />                                                                                                                                                                                        |
| `isMediaScannerScannable` | `boolean`: true if the file is to be scanned by MediaScanner. Files scanned by MediaScanner appear in the applications used to view media (for example, Gallery app). <br />                                                                                              |
| `mimeType`                | `String`: mimetype of the file. <br />                                                                                                                                                                                                                                    |
| `path`                    | `String`: absolute pathname to the file. The file should be world-readable, so that it can be managed by the Downloads App and any other app that is used to read it (for example, Gallery app to display the file, if the file contents represent a video/image). <br /> |
| `length`                  | `long`: length of the downloaded file <br />                                                                                                                                                                                                                              |
| `showNotification`        | `boolean`: true if a notification is to be sent, false otherwise <br />                                                                                                                                                                                                   |
| `uri`                     | `Uri`: the original HTTP URI of the download <br />                                                                                                                                                                                                                       |
| `referer`                 | `Uri`: the HTTP Referer for the download <br />                                                                                                                                                                                                                           |

|                                                                             Returns                                                                             ||
|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | an ID for the download entry added to the downloads app, unique across the system This ID is used to make future calls related to this download. <br /> |

### enqueue

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long enqueue (DownloadManager.Request request)
```

Enqueue a new download. The download will start automatically once the download manager is ready to execute it and connectivity is available.

<br />

|                                      Parameters                                      ||
|-----------|---------------------------------------------------------------------------|
| `request` | `DownloadManager.Request`: the parameters specifying this download <br /> |

|                                                                              Returns                                                                               ||
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `long` | an ID for the download, unique across the system. This ID is used to make future calls related to this download. Returns -1 if the operation fails. <br /> |

### getMaxBytesOverMobile

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Long getMaxBytesOverMobile (Context context)
```

Returns maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no limit

<br />

|                                                                                                          Parameters                                                                                                          ||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: the[Context](https://developer.android.com/reference/android/content/Context)to use for accessing the[ContentResolver](https://developer.android.com/reference/android/content/ContentResolver) <br /> |

|                                                                                    Returns                                                                                    ||
|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [Long](https://developer.android.com/reference/java/lang/Long) | maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no limit <br /> |

### getMimeTypeForDownloadedFile

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getMimeTypeForDownloadedFile (long id)
```

Returns the media type of the given downloaded file id, if the file was downloaded successfully. Otherwise, null is returned.

<br />

|                     Parameters                      ||
|------|-----------------------------------------------|
| `id` | `long`: the id of the downloaded file. <br /> |

|                                                                                Returns                                                                                 ||
|--------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the media type of the given downloaded file id, if download was successful. null otherwise. <br /> |

### getRecommendedMaxBytesOverMobile

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public static Long getRecommendedMaxBytesOverMobile (Context context)
```

Returns recommended maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no recommended limit. The user will have the option to bypass this limit.

<br />

|                                                                                                          Parameters                                                                                                          ||
|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: the[Context](https://developer.android.com/reference/android/content/Context)to use for accessing the[ContentResolver](https://developer.android.com/reference/android/content/ContentResolver) <br /> |

|                                                                                                Returns                                                                                                 ||
|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| [Long](https://developer.android.com/reference/java/lang/Long) | recommended maximum size, in bytes, of downloads that may go over a mobile connection; or null if there's no recommended limit. <br /> |

### getUriForDownloadedFile

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Uri getUriForDownloadedFile (long id)
```

Returns the[Uri](https://developer.android.com/reference/android/net/Uri)of the given downloaded file id, if the file is downloaded successfully. Otherwise, null is returned.

<br />

|                     Parameters                      ||
|------|-----------------------------------------------|
| `id` | `long`: the id of the downloaded file. <br /> |

|                                                                                                       Returns                                                                                                        ||
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri) | the[Uri](https://developer.android.com/reference/android/net/Uri)of the given downloaded file id, if download was successful. null otherwise. <br /> |

### openDownloadedFile

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ParcelFileDescriptor openDownloadedFile (long id)
```

Open a downloaded file for reading. The download must have completed.

<br />

|                 Parameters                  ||
|------|---------------------------------------|
| `id` | `long`: the ID of the download <br /> |

|                                                                                                      Returns                                                                                                       ||
|-------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [ParcelFileDescriptor](https://developer.android.com/reference/android/os/ParcelFileDescriptor) | a read-only[ParcelFileDescriptor](https://developer.android.com/reference/android/os/ParcelFileDescriptor) <br /> |

|                                                                     Throws                                                                     ||
|------------------------------------------------------------------------------------------------|------------------------------------------------|
| [FileNotFoundException](https://developer.android.com/reference/java/io/FileNotFoundException) | if the destination file does not already exist |

### query

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Cursor query (DownloadManager.Query query)
```

Query the download manager about downloads that have been requested.

<br />

|                                      Parameters                                       ||
|---------|------------------------------------------------------------------------------|
| `query` | `DownloadManager.Query`: parameters specifying filters for this query <br /> |

|                                                                                       Returns                                                                                        ||
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|
| [Cursor](https://developer.android.com/reference/android/database/Cursor) | a Cursor over the result set of downloads, with columns consisting of all the COLUMN_\* constants. <br /> |

### remove

Added in[API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int remove (long... ids)
```

Cancel downloads and remove them from the download manager. Each download will be stopped if it was running, and it will no longer be accessible through the download manager. If there is a downloaded file, partial or complete, it is deleted.

<br />

|                        Parameters                        ||
|-------|---------------------------------------------------|
| `ids` | `long`: the IDs of the downloads to remove <br /> |

|                        Returns                         ||
|-------|-------------------------------------------------|
| `int` | the number of downloads actually removed <br /> |