Package com.brightcove.player.network
Class DownloadManager.Request
java.lang.Object
com.brightcove.player.network.DownloadManager.Request
- All Implemented Interfaces:
IDownloadManager.IRequest
- Enclosing class:
- DownloadManager
Provides mutable implementation of
IDownloadManager.IRequest, which can be used to submit
download requests to the IDownloadManager.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.brightcove.player.network.IDownloadManager.IRequest
IDownloadManager.IRequest.Visibility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the description of this download, to be displayed in notifications (if enabled)longGets the estimated total size of the download as number of bytes.Gets the list of headers to the send in HTTP request.android.net.UriGets the local destination for the downloaded file.Gets the MIME content type of this download.intSpecifies whether a system notification is posted by the download manager while this download is running or when it is completed.android.net.UriGets the URL to the remote file.getTitle()Gets the title of this download, to be displayed in notifications (if enabled).booleanSpecifies whether this download may proceed over a bluetooth network connection.booleanSpecifies whether this download may proceed over a metered network connection.booleanSpecifies whether this download may proceed over a mobile network connection.booleanSpecifies whether this download may proceed over a roaming connection.booleanSpecifies whether this download may proceed over a WIFI network connection.booleanSpecifies whether the file to be downloaded should be marked as scannable by MediaScanner.booleanGets whether this download should be displayed in the system's Downloads UI.setAllowedOverBluetooth(boolean allowed) Specifies whether this download may proceed over a bluetooth network connection.setAllowedOverMetered(boolean allowed) Specifies whether this download may proceed over a metered network connection.setAllowedOverMobile(boolean allowed) Specifies whether this download may proceed over a mobile network connection.setAllowedOverRoaming(boolean allowed) Specifies whether this download may proceed over a roaming network connection.setAllowedOverWifi(boolean allowed) Specifies whether this download may proceed over a WIFI network connection.setAllowScanningByMediaScanner(boolean allow) Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.setDescription(String description) Sets the description of this download to be displayed in notifications (if enabled)setEstimatedSize(long estimatedSize) Sets the estimated total size of the download as number of bytes.setHeaders(Map<String, String> headers) Sets the list of headers to the send in HTTP request.setLocalUri(android.net.Uri localUri) Sets the local destination for the downloaded file.setMimeType(String mimeType) Sets the MIME content type of this download.setNotificationVisibility(int visibility) Specifies whether a system notification is posted by the download manager while this download is running or when it is completed.setRemoteUri(android.net.Uri remoteUri) Sets the URL to the remote file.Sets the title of this download to be displayed in notifications (if enabled).setVisibleInDownloadsUi(boolean visible) Specifies whether this download should be displayed in the system's Downloads UI.
-
Constructor Details
-
Request
public Request(android.net.Uri remoteUri) Constructs a new download request.- Parameters:
remoteUri- the URL to the remote file.
-
Request
public Request(android.net.Uri remoteUri, android.net.Uri localUri) Constructs a new download request.- Parameters:
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.
-
-
Method Details
-
getRemoteUri
@NonNull public android.net.Uri getRemoteUri()Description copied from interface:IDownloadManager.IRequestGets the URL to the remote file.- Specified by:
getRemoteUriin interfaceIDownloadManager.IRequest- Returns:
- the URI to the remote file.
-
setRemoteUri
Sets the URL to the remote file.- Parameters:
remoteUri- the URL to the remote file.- Returns:
- this object.
-
getLocalUri
@Nullable public android.net.Uri getLocalUri()Description copied from interface:IDownloadManager.IRequestGets 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.- Specified by:
getLocalUriin interfaceIDownloadManager.IRequest- Returns:
- null or the URI to the local file.
-
setLocalUri
Sets 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.- Parameters:
localUri- the local destination for the downloaded file.- Returns:
- this object.
-
getMimeType
Description copied from interface:IDownloadManager.IRequestGets the MIME content type of this download. This will override the content type declared in the server's response.- Specified by:
getMimeTypein interfaceIDownloadManager.IRequest- Returns:
- null or the mime type string.
-
setMimeType
Sets the MIME content type of this download. This will override the content type declared in the server's response.- Parameters:
mimeType- the MIME content type of this download.- Returns:
- this object.
-
getHeaders
Description copied from interface:IDownloadManager.IRequestGets the list of headers to the send in HTTP request.- Specified by:
getHeadersin interfaceIDownloadManager.IRequest- Returns:
- null or a list of name/value pairs
-
setHeaders
Sets the list of headers to the send in HTTP request.- Parameters:
headers- the list of headers to the send in HTTP request.- Returns:
- this object.
-
getEstimatedSize
public long getEstimatedSize()Description copied from interface:IDownloadManager.IRequestGets the estimated total size of the download as number of bytes.- Specified by:
getEstimatedSizein interfaceIDownloadManager.IRequest- Returns:
- the estimated total size of the download as number of bytes.
-
setEstimatedSize
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.- Returns:
- this object.
-
getTitle
Description copied from interface:IDownloadManager.IRequestGets 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.- Specified by:
getTitlein interfaceIDownloadManager.IRequest- Returns:
- the download title to be displayed in the notification.
-
setTitle
Sets 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.- Parameters:
title- the title of this download.- Returns:
- this object.
-
getDescription
Description copied from interface:IDownloadManager.IRequestGets the description of this download, to be displayed in notifications (if enabled)- Specified by:
getDescriptionin interfaceIDownloadManager.IRequest- Returns:
- the description of this download
-
setDescription
Sets the description of this download to be displayed in notifications (if enabled)- Parameters:
description- the description of this download.- Returns:
- this object.
-
isAllowScanningByMediaScanner
public boolean isAllowScanningByMediaScanner()Description copied from interface:IDownloadManager.IRequestSpecifies whether the file to be downloaded should be marked as scannable by MediaScanner.- Specified by:
isAllowScanningByMediaScannerin interfaceIDownloadManager.IRequest- Returns:
- true if the download file should be marked as scannable, otherwise false.
-
setAllowScanningByMediaScanner
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, otherwise false.- Returns:
- this object.
-
isAllowedOverMobile
public boolean isAllowedOverMobile()Description copied from interface:IDownloadManager.IRequestSpecifies whether this download may proceed over a mobile network connection.- Specified by:
isAllowedOverMobilein interfaceIDownloadManager.IRequest- Returns:
- true if the file can be download over mobile network connection, otherwise false.
-
setAllowedOverMobile
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.- Returns:
- this object.
-
isAllowedOverWifi
public boolean isAllowedOverWifi()Description copied from interface:IDownloadManager.IRequestSpecifies whether this download may proceed over a WIFI network connection.- Specified by:
isAllowedOverWifiin interfaceIDownloadManager.IRequest- Returns:
- true if the file can be download over WIFI network connection, otherwise false.
-
setAllowedOverWifi
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.- Returns:
- this object.
-
isAllowedOverBluetooth
public boolean isAllowedOverBluetooth()Description copied from interface:IDownloadManager.IRequestSpecifies whether this download may proceed over a bluetooth network connection.- Specified by:
isAllowedOverBluetoothin interfaceIDownloadManager.IRequest- Returns:
- true if the file can be download over bluetooth network connection, otherwise false.
-
setAllowedOverBluetooth
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.- Returns:
- this object.
-
isAllowedOverRoaming
public boolean isAllowedOverRoaming()Description copied from interface:IDownloadManager.IRequestSpecifies whether this download may proceed over a roaming connection.- Specified by:
isAllowedOverRoamingin interfaceIDownloadManager.IRequest- Returns:
- true if the file can be download over roaming connection, otherwise false.
-
setAllowedOverRoaming
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.- Returns:
- this object.
-
isAllowedOverMetered
public boolean isAllowedOverMetered()Description copied from interface:IDownloadManager.IRequestSpecifies whether this download may proceed over a metered network connection.- Specified by:
isAllowedOverMeteredin interfaceIDownloadManager.IRequest- Returns:
- true if the file can be download over metered connection, otherwise false.
-
setAllowedOverMetered
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.- Returns:
- this object.
-
isVisibleInDownloadsUi
public boolean isVisibleInDownloadsUi()Description copied from interface:IDownloadManager.IRequestGets whether this download should be displayed in the system's Downloads UI.- Specified by:
isVisibleInDownloadsUiin interfaceIDownloadManager.IRequest- Returns:
- true if the file should be visible in downloads UI, otherwise false.
-
setVisibleInDownloadsUi
Specifies whether this download should be displayed in the system's Downloads UI.- Parameters:
visible- true if this download should be visible, otherwise false.- Returns:
- this object.
-
getNotificationVisibility
public int getNotificationVisibility()Description copied from interface:IDownloadManager.IRequestSpecifies whether a system notification is posted by the download manager while this download is running or when it is completed.- Specified by:
getNotificationVisibilityin interfaceIDownloadManager.IRequest- Returns:
- the visibility constant.
-
setNotificationVisibility
Specifies whether a system notification is posted by the download manager while this download is running or when it is completed.- Parameters:
visibility- aIDownloadManager.IRequest.Visibilityconstant.- Returns:
- this object.
-