-
- All Implemented Interfaces:
-
com.brightcove.player.network.IDownloadManager.IRequest
public class DownloadManager.Request implements IDownloadManager.IRequest
Provides mutable implementation of IRequest, which can be used to submitdownload requests to the IDownloadManager.
-
-
Field Summary
Fields Modifier and Type Field Description long
estimatedSize
boolean
allowScanningByMediaScanner
int
notificationVisibility
private Uri
remoteUri
private Uri
localUri
private String
mimeType
private Map<String, String>
headers
private String
title
private String
description
private boolean
allowedOverMobile
private boolean
allowedOverWifi
private boolean
allowedOverBluetooth
private boolean
allowedOverRoaming
private boolean
allowedOverMetered
private boolean
visibleInDownloadsUi
-
Constructor Summary
Constructors Constructor Description DownloadManager.Request(Uri remoteUri)
Constructs a new download request. DownloadManager.Request(Uri remoteUri, Uri localUri)
Constructs a new download request.
-
Method Summary
Modifier and Type Method Description long
getEstimatedSize()
Gets the estimated total size of the download as number of bytes. DownloadManager.Request
setEstimatedSize(long estimatedSize)
Sets the estimated total size of the download as number of bytes. DownloadManager.Request
setAllowScanningByMediaScanner(boolean allow)
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner. int
getNotificationVisibility()
Specifies whether a system notification is posted by the download manager while thisdownload is running or when it is completed. DownloadManager.Request
setNotificationVisibility(int visibility)
Specifies whether a system notification is posted by the download manager while thisdownload is running or when it is completed. Uri
getRemoteUri()
Gets the URL to the remote file. DownloadManager.Request
setRemoteUri(@NonNull() Uri remoteUri)
Sets the URL to the remote file. Uri
getLocalUri()
Gets the local destination for the downloaded file. DownloadManager.Request
setLocalUri(@NonNull() Uri localUri)
Sets the local destination for the downloaded file. String
getMimeType()
Gets the MIME content type of this download. DownloadManager.Request
setMimeType(String mimeType)
Sets the MIME content type of this download. Map<String, String>
getHeaders()
Gets the list of headers to the send in HTTP request. DownloadManager.Request
setHeaders(Map<String, String> headers)
Sets the list of headers to the send in HTTP request. String
getTitle()
Gets the title of this download, to be displayed in notifications (if enabled). DownloadManager.Request
setTitle(String title)
Sets the title of this download to be displayed in notifications (if enabled). String
getDescription()
Gets the description of this download, to be displayed in notifications (if enabled) DownloadManager.Request
setDescription(String description)
Sets the description of this download to be displayed in notifications (if enabled) DownloadManager.Request
setAllowedOverMobile(boolean allowed)
Specifies whether this download may proceed over a mobile network connection. DownloadManager.Request
setAllowedOverWifi(boolean allowed)
Specifies whether this download may proceed over a WIFI network connection. DownloadManager.Request
setAllowedOverBluetooth(boolean allowed)
Specifies whether this download may proceed over a bluetooth network connection. DownloadManager.Request
setAllowedOverRoaming(boolean allowed)
Specifies whether this download may proceed over a roaming network connection. DownloadManager.Request
setAllowedOverMetered(boolean allowed)
Specifies whether this download may proceed over a metered network connection. DownloadManager.Request
setVisibleInDownloadsUi(boolean visible)
Specifies whether this download should be displayed in the system's Downloads UI. boolean
isAllowScanningByMediaScanner()
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner. boolean
isAllowedOverMobile()
Specifies whether this download may proceed over a mobile network connection. boolean
isAllowedOverWifi()
Specifies whether this download may proceed over a WIFI network connection. boolean
isAllowedOverBluetooth()
Specifies whether this download may proceed over a bluetooth network connection. boolean
isAllowedOverRoaming()
Specifies whether this download may proceed over a roaming connection. boolean
isAllowedOverMetered()
Specifies whether this download may proceed over a metered network connection. boolean
isVisibleInDownloadsUi()
Gets whether this download should be displayed in the system's Downloads UI. -
-
Constructor Detail
-
DownloadManager.Request
DownloadManager.Request(Uri remoteUri)
Constructs a new download request.- Parameters:
remoteUri
- the URL to the remote file.
-
-
Method Detail
-
getEstimatedSize
long getEstimatedSize()
Gets the estimated total size of the download as number of bytes.
-
setEstimatedSize
DownloadManager.Request setEstimatedSize(long estimatedSize)
Sets the estimated total size of the download as number of bytes.
- Parameters:
estimatedSize
- the estimated total size of the download as number of bytes.
-
setAllowScanningByMediaScanner
DownloadManager.Request setAllowScanningByMediaScanner(boolean allow)
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.
- Parameters:
allow
- true if the file to be downloaded should be marked as scannable, otherwisefalse.
-
getNotificationVisibility
int getNotificationVisibility()
Specifies whether a system notification is posted by the download manager while thisdownload is running or when it is completed.
-
setNotificationVisibility
DownloadManager.Request setNotificationVisibility(int visibility)
Specifies whether a system notification is posted by the download manager while thisdownload is running or when it is completed.
- Parameters:
visibility
- a Visibility constant.
-
getRemoteUri
@NonNull() Uri getRemoteUri()
Gets the URL to the remote file.
-
setRemoteUri
DownloadManager.Request setRemoteUri(@NonNull() Uri remoteUri)
Sets the URL to the remote file.
- Parameters:
remoteUri
- the URL to the remote file.
-
getLocalUri
@Nullable() Uri getLocalUri()
Gets the local destination for the downloaded file. Must be a file URI to a path onexternal storage, and the calling application must have the WRITE_EXTERNAL_STORAGEpermission. If the value is null, the download file will be placed in the applicationsdownload directory.
-
setLocalUri
DownloadManager.Request setLocalUri(@NonNull() Uri localUri)
Sets the local destination for the downloaded file. Must be a file URI to a path onexternal storage, and the calling application must have the WRITE_EXTERNAL_STORAGEpermission.
- Parameters:
localUri
- the local destination for the downloaded file.
-
getMimeType
@Nullable() String getMimeType()
Gets the MIME content type of this download. This will override the content type declaredin the server's response.
-
setMimeType
DownloadManager.Request setMimeType(String mimeType)
Sets the MIME content type of this download. This will override the content type declaredin the server's response.
- Parameters:
mimeType
- the MIME content type of this download.
-
getHeaders
@Nullable() Map<String, String> getHeaders()
Gets the list of headers to the send in HTTP request.
-
setHeaders
DownloadManager.Request setHeaders(Map<String, String> headers)
Sets the list of headers to the send in HTTP request.
- Parameters:
headers
- the list of headers to the send in HTTP request.
-
getTitle
@Nullable() String getTitle()
Gets the title of this download, to be displayed in notifications (if enabled). If notitle is given, a default one will be assigned based on the download filename, once thedownload starts.
-
setTitle
DownloadManager.Request setTitle(String title)
Sets the title of this download to be displayed in notifications (if enabled). If notitle is given, a default one will be assigned based on the download filename, once thedownload starts.
- Parameters:
title
- the title of this download.
-
getDescription
@Nullable() String getDescription()
Gets the description of this download, to be displayed in notifications (if enabled)
-
setDescription
DownloadManager.Request setDescription(String description)
Sets the description of this download to be displayed in notifications (if enabled)
- Parameters:
description
- the description of this download.
-
setAllowedOverMobile
DownloadManager.Request setAllowedOverMobile(boolean allowed)
Specifies whether this download may proceed over a mobile network connection.
- Parameters:
allowed
- true if this download may proceed over a mobile network connection,otherwise false.
-
setAllowedOverWifi
DownloadManager.Request setAllowedOverWifi(boolean allowed)
Specifies whether this download may proceed over a WIFI network connection.
- Parameters:
allowed
- true if this download may proceed over a WIFI network connection,otherwise false.
-
setAllowedOverBluetooth
DownloadManager.Request setAllowedOverBluetooth(boolean allowed)
Specifies whether this download may proceed over a bluetooth network connection.
- Parameters:
allowed
- true if this download may proceed over a bluetooth network connection,otherwise false.
-
setAllowedOverRoaming
DownloadManager.Request setAllowedOverRoaming(boolean allowed)
Specifies whether this download may proceed over a roaming network connection.
- Parameters:
allowed
- true if this download may proceed over a roaming network connection,otherwise false.
-
setAllowedOverMetered
DownloadManager.Request setAllowedOverMetered(boolean allowed)
Specifies whether this download may proceed over a metered network connection.
- Parameters:
allowed
- true if this download may proceed over a metered network connection,otherwise false.
-
setVisibleInDownloadsUi
DownloadManager.Request setVisibleInDownloadsUi(boolean visible)
Specifies whether this download should be displayed in the system's Downloads UI.
- Parameters:
visible
- true if this download should be visible, otherwise false.
-
isAllowScanningByMediaScanner
boolean isAllowScanningByMediaScanner()
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.
-
isAllowedOverMobile
boolean isAllowedOverMobile()
Specifies whether this download may proceed over a mobile network connection.
-
isAllowedOverWifi
boolean isAllowedOverWifi()
Specifies whether this download may proceed over a WIFI network connection.
-
isAllowedOverBluetooth
boolean isAllowedOverBluetooth()
Specifies whether this download may proceed over a bluetooth network connection.
-
isAllowedOverRoaming
boolean isAllowedOverRoaming()
Specifies whether this download may proceed over a roaming connection.
-
isAllowedOverMetered
boolean isAllowedOverMetered()
Specifies whether this download may proceed over a metered network connection.
-
isVisibleInDownloadsUi
boolean isVisibleInDownloadsUi()
Gets whether this download should be displayed in the system's Downloads UI.
-
-
-
-