public static class DownloadManager.Request extends java.lang.Object implements IDownloadManager.IRequest
IRequest
, which can be used to submit
download requests to the IDownloadManager
.IDownloadManager.IRequest.Visibility
Constructor and Description |
---|
Request(android.net.Uri remoteUri)
Constructs a new download request.
|
Request(android.net.Uri remoteUri,
android.net.Uri localUri)
Constructs a new download request.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Gets the description of this download, to be displayed in notifications (if enabled)
|
long |
getEstimatedSize()
Gets the estimated total size of the download as number of bytes.
|
java.util.Map<java.lang.String,java.lang.String> |
getHeaders()
Gets the list of headers to the send in HTTP request.
|
android.net.Uri |
getLocalUri()
Gets the local destination for the downloaded file.
|
java.lang.String |
getMimeType()
Gets the MIME content type of this download.
|
int |
getNotificationVisibility()
Specifies whether a system notification is posted by the download manager while this
download is running or when it is completed.
|
android.net.Uri |
getRemoteUri()
Gets the URL to the remote file.
|
java.lang.String |
getTitle()
Gets the title of this download, to be displayed in notifications (if enabled).
|
boolean |
isAllowedOverBluetooth()
Specifies whether this download may proceed over a bluetooth network connection.
|
boolean |
isAllowedOverMetered()
Specifies whether this download may proceed over a metered network connection.
|
boolean |
isAllowedOverMobile()
Specifies whether this download may proceed over a mobile network connection.
|
boolean |
isAllowedOverRoaming()
Specifies whether this download may proceed over a roaming connection.
|
boolean |
isAllowedOverWifi()
Specifies whether this download may proceed over a WIFI network connection.
|
boolean |
isAllowScanningByMediaScanner()
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.
|
boolean |
isVisibleInDownloadsUi()
Gets whether this download should be displayed in the system's Downloads UI.
|
DownloadManager.Request |
setAllowedOverBluetooth(boolean allowed)
Specifies whether this download may proceed over a bluetooth network connection.
|
DownloadManager.Request |
setAllowedOverMetered(boolean allowed)
Specifies whether this download may proceed over a metered network connection.
|
DownloadManager.Request |
setAllowedOverMobile(boolean allowed)
Specifies whether this download may proceed over a mobile network connection.
|
DownloadManager.Request |
setAllowedOverRoaming(boolean allowed)
Specifies whether this download may proceed over a roaming network connection.
|
DownloadManager.Request |
setAllowedOverWifi(boolean allowed)
Specifies whether this download may proceed over a WIFI network connection.
|
DownloadManager.Request |
setAllowScanningByMediaScanner(boolean allow)
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.
|
DownloadManager.Request |
setDescription(java.lang.String description)
Sets the description of this download to be displayed in notifications (if enabled)
|
DownloadManager.Request |
setEstimatedSize(long estimatedSize)
Sets the estimated total size of the download as number of bytes.
|
DownloadManager.Request |
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the list of headers to the send in HTTP request.
|
DownloadManager.Request |
setLocalUri(android.net.Uri localUri)
Sets the local destination for the downloaded file.
|
DownloadManager.Request |
setMimeType(java.lang.String mimeType)
Sets the MIME content type of this download.
|
DownloadManager.Request |
setNotificationVisibility(int visibility)
Specifies whether a system notification is posted by the download manager while this
download is running or when it is completed.
|
DownloadManager.Request |
setRemoteUri(android.net.Uri remoteUri)
Sets the URL to the remote file.
|
DownloadManager.Request |
setTitle(java.lang.String title)
Sets the title of this download to be displayed in notifications (if enabled).
|
DownloadManager.Request |
setVisibleInDownloadsUi(boolean visible)
Specifies whether this download should be displayed in the system's Downloads UI.
|
public Request(android.net.Uri remoteUri)
remoteUri
- the URL to the remote file.public Request(android.net.Uri remoteUri, android.net.Uri localUri)
remoteUri
- the URL to the remote file.localUri
- 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. If the value is null, the download
file will be placed in the applications download directory.@NonNull public android.net.Uri getRemoteUri()
IDownloadManager.IRequest
getRemoteUri
in interface IDownloadManager.IRequest
public DownloadManager.Request setRemoteUri(@NonNull android.net.Uri remoteUri)
remoteUri
- the URL to the remote file.@Nullable public android.net.Uri getLocalUri()
IDownloadManager.IRequest
getLocalUri
in interface IDownloadManager.IRequest
public DownloadManager.Request setLocalUri(@NonNull android.net.Uri localUri)
localUri
- the local destination for the downloaded file.@Nullable public java.lang.String getMimeType()
IDownloadManager.IRequest
getMimeType
in interface IDownloadManager.IRequest
public DownloadManager.Request setMimeType(java.lang.String mimeType)
mimeType
- the MIME content type of this download.@Nullable public java.util.Map<java.lang.String,java.lang.String> getHeaders()
IDownloadManager.IRequest
getHeaders
in interface IDownloadManager.IRequest
public DownloadManager.Request setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
headers
- the list of headers to the send in HTTP request.public long getEstimatedSize()
IDownloadManager.IRequest
getEstimatedSize
in interface IDownloadManager.IRequest
public DownloadManager.Request setEstimatedSize(long estimatedSize)
estimatedSize
- the estimated total size of the download as number of bytes.@Nullable public java.lang.String getTitle()
IDownloadManager.IRequest
getTitle
in interface IDownloadManager.IRequest
public DownloadManager.Request setTitle(java.lang.String title)
title
- the title of this download.@Nullable public java.lang.String getDescription()
IDownloadManager.IRequest
getDescription
in interface IDownloadManager.IRequest
public DownloadManager.Request setDescription(java.lang.String description)
description
- the description of this download.public boolean isAllowScanningByMediaScanner()
IDownloadManager.IRequest
isAllowScanningByMediaScanner
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowScanningByMediaScanner(boolean allow)
allow
- true if the file to be downloaded should be marked as scannable, otherwise
false.public boolean isAllowedOverMobile()
IDownloadManager.IRequest
isAllowedOverMobile
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowedOverMobile(boolean allowed)
allowed
- true if this download may proceed over a mobile network connection,
otherwise false.public boolean isAllowedOverWifi()
IDownloadManager.IRequest
isAllowedOverWifi
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowedOverWifi(boolean allowed)
allowed
- true if this download may proceed over a WIFI network connection,
otherwise false.public boolean isAllowedOverBluetooth()
IDownloadManager.IRequest
isAllowedOverBluetooth
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowedOverBluetooth(boolean allowed)
allowed
- true if this download may proceed over a bluetooth network connection,
otherwise false.public boolean isAllowedOverRoaming()
IDownloadManager.IRequest
isAllowedOverRoaming
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowedOverRoaming(boolean allowed)
allowed
- true if this download may proceed over a roaming network connection,
otherwise false.public boolean isAllowedOverMetered()
IDownloadManager.IRequest
isAllowedOverMetered
in interface IDownloadManager.IRequest
public DownloadManager.Request setAllowedOverMetered(boolean allowed)
allowed
- true if this download may proceed over a metered network connection,
otherwise false.public boolean isVisibleInDownloadsUi()
IDownloadManager.IRequest
isVisibleInDownloadsUi
in interface IDownloadManager.IRequest
public DownloadManager.Request setVisibleInDownloadsUi(boolean visible)
visible
- true if this download should be visible, otherwise false.public int getNotificationVisibility()
IDownloadManager.IRequest
getNotificationVisibility
in interface IDownloadManager.IRequest
public DownloadManager.Request setNotificationVisibility(int visibility)
visibility
- a Visibility
constant.