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
public static class DownloadManager.Request extends java.lang.Object implements IDownloadManager.IRequest
Provides mutable implementation ofIDownloadManager.IRequest, which can be used to submit download requests to theIDownloadManager.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.brightcove.player.network.IDownloadManager.IRequest
IDownloadManager.IRequest.Visibility
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()Gets the description of this download, to be displayed in notifications (if enabled)longgetEstimatedSize()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.UrigetLocalUri()Gets the local destination for the downloaded file.java.lang.StringgetMimeType()Gets the MIME content type of this download.intgetNotificationVisibility()Specifies whether a system notification is posted by the download manager while this download is running or when it is completed.android.net.UrigetRemoteUri()Gets the URL to the remote file.java.lang.StringgetTitle()Gets the title of this download, to be displayed in notifications (if enabled).booleanisAllowedOverBluetooth()Specifies whether this download may proceed over a bluetooth network connection.booleanisAllowedOverMetered()Specifies whether this download may proceed over a metered network connection.booleanisAllowedOverMobile()Specifies whether this download may proceed over a mobile network connection.booleanisAllowedOverRoaming()Specifies whether this download may proceed over a roaming connection.booleanisAllowedOverWifi()Specifies whether this download may proceed over a WIFI network connection.booleanisAllowScanningByMediaScanner()Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.booleanisVisibleInDownloadsUi()Gets whether this download should be displayed in the system's Downloads UI.DownloadManager.RequestsetAllowedOverBluetooth(boolean allowed)Specifies whether this download may proceed over a bluetooth network connection.DownloadManager.RequestsetAllowedOverMetered(boolean allowed)Specifies whether this download may proceed over a metered network connection.DownloadManager.RequestsetAllowedOverMobile(boolean allowed)Specifies whether this download may proceed over a mobile network connection.DownloadManager.RequestsetAllowedOverRoaming(boolean allowed)Specifies whether this download may proceed over a roaming network connection.DownloadManager.RequestsetAllowedOverWifi(boolean allowed)Specifies whether this download may proceed over a WIFI network connection.DownloadManager.RequestsetAllowScanningByMediaScanner(boolean allow)Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.DownloadManager.RequestsetDescription(java.lang.String description)Sets the description of this download to be displayed in notifications (if enabled)DownloadManager.RequestsetEstimatedSize(long estimatedSize)Sets the estimated total size of the download as number of bytes.DownloadManager.RequestsetHeaders(java.util.Map<java.lang.String,java.lang.String> headers)Sets the list of headers to the send in HTTP request.DownloadManager.RequestsetLocalUri(android.net.Uri localUri)Sets the local destination for the downloaded file.DownloadManager.RequestsetMimeType(java.lang.String mimeType)Sets the MIME content type of this download.DownloadManager.RequestsetNotificationVisibility(int visibility)Specifies whether a system notification is posted by the download manager while this download is running or when it is completed.DownloadManager.RequestsetRemoteUri(android.net.Uri remoteUri)Sets the URL to the remote file.DownloadManager.RequestsetTitle(java.lang.String title)Sets the title of this download to be displayed in notifications (if enabled).DownloadManager.RequestsetVisibleInDownloadsUi(boolean visible)Specifies whether this download should be displayed in the system's Downloads UI.
-
-
-
Constructor Detail
-
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 Detail
-
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
public DownloadManager.Request setRemoteUri(@NonNull android.net.Uri remoteUri)
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
public DownloadManager.Request setLocalUri(@NonNull android.net.Uri localUri)
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
@Nullable public java.lang.String 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
public DownloadManager.Request setMimeType(java.lang.String mimeType)
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
@Nullable public java.util.Map<java.lang.String,java.lang.String> 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
public DownloadManager.Request setHeaders(java.util.Map<java.lang.String,java.lang.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.- 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
public 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.- Returns:
- this object.
-
getTitle
@Nullable public java.lang.String 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
public DownloadManager.Request setTitle(java.lang.String title)
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
@Nullable public java.lang.String 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
public DownloadManager.Request setDescription(java.lang.String description)
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
public 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, 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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- 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
public 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.- Parameters:
visibility- aIDownloadManager.IRequest.Visibilityconstant.- Returns:
- this object.
-
-