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.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.
-
-
-
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.IRequest
Gets the URL to the remote file.- Specified by:
getRemoteUri
in 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.IRequest
Gets 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:
getLocalUri
in 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.IRequest
Gets the MIME content type of this download. This will override the content type declared in the server's response.- Specified by:
getMimeType
in 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.IRequest
Gets the list of headers to the send in HTTP request.- Specified by:
getHeaders
in 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.IRequest
Gets the estimated total size of the download as number of bytes.- Specified by:
getEstimatedSize
in 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.IRequest
Gets 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:
getTitle
in 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.IRequest
Gets the description of this download, to be displayed in notifications (if enabled)- Specified by:
getDescription
in 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.IRequest
Specifies whether the file to be downloaded should be marked as scannable by MediaScanner.- Specified by:
isAllowScanningByMediaScanner
in 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.IRequest
Specifies whether this download may proceed over a mobile network connection.- Specified by:
isAllowedOverMobile
in 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.IRequest
Specifies whether this download may proceed over a WIFI network connection.- Specified by:
isAllowedOverWifi
in 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.IRequest
Specifies whether this download may proceed over a bluetooth network connection.- Specified by:
isAllowedOverBluetooth
in 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.IRequest
Specifies whether this download may proceed over a roaming connection.- Specified by:
isAllowedOverRoaming
in 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.IRequest
Specifies whether this download may proceed over a metered network connection.- Specified by:
isAllowedOverMetered
in 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.IRequest
Gets whether this download should be displayed in the system's Downloads UI.- Specified by:
isVisibleInDownloadsUi
in 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.IRequest
Specifies whether a system notification is posted by the download manager while this download is running or when it is completed.- Specified by:
getNotificationVisibility
in 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.Visibility
constant.- Returns:
- this object.
-
-