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

# Request

*** ** * ** ***

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

```
open class Request
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#) |

This class contains all the information necessary to request a new download. The URI is the only required parameter. Note that the default download destination is a shared volume where the system might delete your file if it needs to reclaim space for system use. If this is a problem, use a location on external storage (see `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setDestinationUri(android.net.Uri)`.

## Summary

| Constants ||
|---|---|
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#NETWORK_MOBILE:kotlin.Int` Bit flag for `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedNetworkTypes(kotlin.Int)` corresponding to `https://developer.android.com/reference/kotlin/android/net/ConnectivityManager.html#TYPE_MOBILE:kotlin.Int`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#NETWORK_WIFI:kotlin.Int` Bit flag for `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedNetworkTypes(kotlin.Int)` corresponding to `https://developer.android.com/reference/kotlin/android/net/ConnectivityManager.html#TYPE_WIFI:kotlin.Int`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_HIDDEN:kotlin.Int` This download doesn't show in the UI or in the notifications. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_VISIBLE:kotlin.Int` This download is visible but only shows in the notifications while it's in progress. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_VISIBLE_NOTIFY_COMPLETED:kotlin.Int` This download is visible and shows in the notifications while in progress and after completion. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION:kotlin.Int` This download shows in the notifications after completion ONLY. |

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#Request(android.net.Uri)(uri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` <br /> |

| Public methods ||
|---|---|
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#addRequestHeader(kotlin.String,%20kotlin.String)(header: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Add an HTTP header to be included with the download request. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#allowScanningByMediaScanner()()` If the file to be downloaded is to be scanned by MediaScanner, this method should be called before `https://developer.android.com/reference/kotlin/android/app/DownloadManager#enqueue(android.app.DownloadManager.Request)` is called. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedNetworkTypes(kotlin.Int)(flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Restrict the types of networks over which this download may proceed. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedOverMetered(kotlin.Boolean)(allow: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this download may proceed over a metered network connection. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedOverRoaming(kotlin.Boolean)(allowed: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this download may proceed over a roaming connection. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setDescription(kotlin.CharSequence)(description: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Set a description of this download, to be displayed in notifications (if enabled) |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setDestinationInExternalFilesDir(android.content.Context,%20kotlin.String,%20kotlin.String)(context: https://developer.android.com/reference/kotlin/android/content/Context.html#!, dirType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, subPath: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set the local destination for the downloaded file to a path within the application's external files directory (as returned by `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)`. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setDestinationInExternalPublicDir(kotlin.String,%20kotlin.String)(dirType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!, subPath: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set the local destination for the downloaded file to a path within the public external storage directory (as returned by `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStoragePublicDirectory(kotlin.String)`). |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setDestinationUri(android.net.Uri)(uri: https://developer.android.com/reference/kotlin/android/net/Uri.html#!)` Set the local destination for the downloaded file. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setMimeType(kotlin.String)(mimeType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Set the MIME content type of this download. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setNotificationVisibility(kotlin.Int)(visibility: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Control whether a system notification is posted by the download manager while this download is running or when it is completed. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setRequiresCharging(kotlin.Boolean)(requiresCharging: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Specify that to run this download, the device needs to be plugged in. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setRequiresDeviceIdle(kotlin.Boolean)(requiresDeviceIdle: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Specify that to run, the download needs the device to be in idle mode. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setShowRunningNotification(kotlin.Boolean)(show: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Control whether a system notification is posted by the download manager while this download is running. |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setTitle(kotlin.CharSequence)(title: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!)` Set the title of this download, to be displayed in notifications (if enabled). |
| open [DownloadManager.Request](https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#)! | `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setVisibleInDownloadsUi(kotlin.Boolean)(isVisible: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Set whether this download should be displayed in the system's Downloads UI. |

## Constants

### NETWORK_MOBILE

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

```
static val NETWORK_MOBILE: Int
```

Bit flag for `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedNetworkTypes(kotlin.Int)` corresponding to `https://developer.android.com/reference/kotlin/android/net/ConnectivityManager.html#TYPE_MOBILE:kotlin.Int`.

    Value: 1

### NETWORK_WIFI

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

```
static val NETWORK_WIFI: Int
```

Bit flag for `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedNetworkTypes(kotlin.Int)` corresponding to `https://developer.android.com/reference/kotlin/android/net/ConnectivityManager.html#TYPE_WIFI:kotlin.Int`.

    Value: 2

### VISIBILITY_HIDDEN

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

```
static val VISIBILITY_HIDDEN: Int
```

This download doesn't show in the UI or in the notifications.

    Value: 2

### VISIBILITY_VISIBLE

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

```
static val VISIBILITY_VISIBLE: Int
```

This download is visible but only shows in the notifications while it's in progress.

    Value: 0

### VISIBILITY_VISIBLE_NOTIFY_COMPLETED

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

```
static val VISIBILITY_VISIBLE_NOTIFY_COMPLETED: Int
```

This download is visible and shows in the notifications while in progress and after completion.

    Value: 1

### VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION

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

```
static val VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION: Int
```

This download shows in the notifications after completion ONLY. It is usuable only with `https://developer.android.com/reference/kotlin/android/app/DownloadManager#addCompletedDownload(kotlin.String,%20kotlin.String,%20kotlin.Boolean,%20kotlin.String,%20kotlin.String,%20kotlin.Long,%20kotlin.Boolean)`.

    Value: 3

## Public constructors

### Request

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

```
Request(uri: Uri!)
```

| Parameters ||
|---|---|
| `uri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!: the HTTP or HTTPS URI to download. |

## Public methods

### addRequestHeader

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

```
open fun addRequestHeader(
    header: String!, 
    value: String!
): DownloadManager.Request!
```

Add an HTTP header to be included with the download request. The header will be added to the end of the list.

| Parameters ||
|---|---|
| `header` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: HTTP header name |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: header value |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

**See Also**

### allowScanningByMediaScanner

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

```
open fun allowScanningByMediaScanner(): Unit
```

**Deprecated:** *Starting in Q, this value is ignored. Files downloaded to directories owned by applications (e.g. `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)`) will not be scanned by MediaScanner and the rest will be scanned.*

If the file to be downloaded is to be scanned by MediaScanner, this method should be called before `https://developer.android.com/reference/kotlin/android/app/DownloadManager#enqueue(android.app.DownloadManager.Request)` is called.

### setAllowedNetworkTypes

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

```
open fun setAllowedNetworkTypes(flags: Int): DownloadManager.Request!
```

Restrict the types of networks over which this download may proceed. By default, all network types are allowed. Consider using `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedOverMetered(kotlin.Boolean)` instead, since it's more flexible.

As of `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#N:kotlin.Int`, setting only the `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#NETWORK_WIFI:kotlin.Int` flag here is equivalent to calling `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setAllowedOverMetered(kotlin.Boolean)` with `false`.

| Parameters ||
|---|---|
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): any combination of the NETWORK_\* bit flags. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setAllowedOverMetered

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

```
open fun setAllowedOverMetered(allow: Boolean): DownloadManager.Request!
```

Set whether this download may proceed over a metered network connection. By default, metered networks are allowed.
**See Also**

- `https://developer.android.com/reference/kotlin/android/net/ConnectivityManager.html#isActiveNetworkMetered()`

### setAllowedOverRoaming

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

```
open fun setAllowedOverRoaming(allowed: Boolean): DownloadManager.Request!
```

Set whether this download may proceed over a roaming connection. By default, roaming is allowed.

| Parameters ||
|---|---|
| `allowed` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether to allow a roaming connection to be used |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setDescription

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

```
open fun setDescription(description: CharSequence!): DownloadManager.Request!
```

Set a description of this download, to be displayed in notifications (if enabled)

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setDestinationInExternalFilesDir

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

```
open fun setDestinationInExternalFilesDir(
    context: Context!, 
    dirType: String!, 
    subPath: String!
): DownloadManager.Request!
```

Set the local destination for the downloaded file to a path within the application's external files directory (as returned by `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)`.

The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#allowScanningByMediaScanner()`.

| Parameters ||
|---|---|
| `context` | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)!: the `https://developer.android.com/reference/kotlin/android/content/Context.html#` to use in determining the external files directory |
| `dirType` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the directory type to pass to `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)` |
| `subPath` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the path within the external directory, including the destination filename |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | If the external storage directory cannot be found or created. |

### setDestinationInExternalPublicDir

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

```
open fun setDestinationInExternalPublicDir(
    dirType: String!, 
    subPath: String!
): DownloadManager.Request!
```

Set the local destination for the downloaded file to a path within the public external storage directory (as returned by `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStoragePublicDirectory(kotlin.String)`).

The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#allowScanningByMediaScanner()`.

For applications targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` or above, `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE:kotlin.String` permission is not needed and the `dirType` must be one of the known public directories like `https://developer.android.com/reference/kotlin/android/os/Environment.html#DIRECTORY_DOWNLOADS:kotlin.String`, `https://developer.android.com/reference/kotlin/android/os/Environment.html#DIRECTORY_PICTURES:kotlin.String`, `https://developer.android.com/reference/kotlin/android/os/Environment.html#DIRECTORY_MOVIES:kotlin.String`, etc.

| Parameters ||
|---|---|
| `dirType` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the directory type to pass to `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStoragePublicDirectory(kotlin.String)` |
| `subPath` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the path within the external directory, including the destination filename |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | If the external storage directory cannot be found or created. |

### setDestinationUri

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

```
open fun setDestinationUri(uri: Uri!): DownloadManager.Request!
```

Set the local destination for the downloaded file. Must be a file URI to a path on external storage, and the calling application must have the WRITE_EXTERNAL_STORAGE permission.

The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#allowScanningByMediaScanner()`.

By default, downloads are saved to a generated filename in the shared download cache and may be deleted by the system at any time to reclaim space.

For applications targeting `https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#Q:kotlin.Int` or above, `https://developer.android.com/reference/kotlin/android/Manifest.permission.html#WRITE_EXTERNAL_STORAGE:kotlin.String` permission is not needed and the `uri` must refer to a path within the directories owned by the application (e.g. `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)`) or a path within the top-level Downloads directory (as returned by `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStoragePublicDirectory(kotlin.String)` with `https://developer.android.com/reference/kotlin/android/os/Environment.html#DIRECTORY_DOWNLOADS:kotlin.String`). All non-visible downloads that are not modified in the last 7 days will be deleted during idle runs.

| Parameters ||
|---|---|
| `uri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!: a file `https://developer.android.com/reference/kotlin/android/net/Uri.html#` indicating the destination for the downloaded file. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setMimeType

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

```
open fun setMimeType(mimeType: String!): DownloadManager.Request!
```

Set the MIME content type of this download. This will override the content type declared in the server's response.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

**See Also**

### setNotificationVisibility

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

```
open fun setNotificationVisibility(visibility: Int): DownloadManager.Request!
```

Control whether a system notification is posted by the download manager while this download is running or when it is completed. If enabled, the download manager posts notifications about downloads through the system `https://developer.android.com/reference/kotlin/android/app/NotificationManager`. By default, a notification is shown only when the download is in progress.

It can take the following values: `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_HIDDEN:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_VISIBLE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_VISIBLE_NOTIFY_COMPLETED:kotlin.Int`.

If set to `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#VISIBILITY_HIDDEN:kotlin.Int`, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION.

| Parameters ||
|---|---|
| `visibility` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the visibility setting value |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setRequiresCharging

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

```
open fun setRequiresCharging(requiresCharging: Boolean): DownloadManager.Request!
```

Specify that to run this download, the device needs to be plugged in. This defaults to false.

| Parameters ||
|---|---|
| `requiresCharging` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether or not the device is plugged in. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/job/JobInfo.Builder#setRequiresCharging(kotlin.Boolean)`

### setRequiresDeviceIdle

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

```
open fun setRequiresDeviceIdle(requiresDeviceIdle: Boolean): DownloadManager.Request!
```

Specify that to run, the download needs the device to be in idle mode. This defaults to false.

Idle mode is a loose definition provided by the system, which means that the device is not in use, and has not been in use for some time.

| Parameters ||
|---|---|
| `requiresDeviceIdle` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether or not the device need be within an idle maintenance window. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/job/JobInfo.Builder#setRequiresDeviceIdle(kotlin.Boolean)`

### setShowRunningNotification

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

```
open fun setShowRunningNotification(show: Boolean): DownloadManager.Request!
```

**Deprecated:** *use `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#setNotificationVisibility(kotlin.Int)`*

Control whether a system notification is posted by the download manager while this download is running. If enabled, the download manager posts notifications about downloads through the system `https://developer.android.com/reference/kotlin/android/app/NotificationManager`. By default, a notification is shown. If set to false, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION.

| Parameters ||
|---|---|
| `show` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether the download manager should show a notification for this download. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setTitle

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

```
open fun setTitle(title: CharSequence!): DownloadManager.Request!
```

Set the title of this download, to be displayed in notifications (if enabled). If no title is given, a default one will be assigned based on the download filename, once the download starts.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |

### setVisibleInDownloadsUi

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

```
open fun setVisibleInDownloadsUi(isVisible: Boolean): DownloadManager.Request!
```

**Deprecated:** *Starting in Q, this value is ignored. Only files downloaded to public Downloads directory (as returned by `https://developer.android.com/reference/kotlin/android/os/Environment.html#getExternalStoragePublicDirectory(kotlin.String)` with `https://developer.android.com/reference/kotlin/android/os/Environment.html#DIRECTORY_DOWNLOADS:kotlin.String`) will be visible in system's Downloads UI and the rest will not be visible. All non-visible downloads that are not modified in the last 7 days will be deleted during idle runs. (e.g. `https://developer.android.com/reference/kotlin/android/content/Context.html#getExternalFilesDir(kotlin.String)`) will not be visible.*

Set whether this download should be displayed in the system's Downloads UI. True by default.

| Parameters ||
|---|---|
| `isVisible` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): whether to display this download in the Downloads UI |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/DownloadManager.Request#!` | this object |