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 Object implements IDownloadManager.IRequest
Provides mutable implementation of IDownloadManager.IRequest, which can be used to submit download requests to the IDownloadManager.
  • 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.IRequest
      Gets the URL to the remote file.
      Specified by:
      getRemoteUri in interface IDownloadManager.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 interface IDownloadManager.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 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 interface IDownloadManager.IRequest
      Returns:
      null or the mime type string.
    • setMimeType

      public DownloadManager.Request setMimeType(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 Map<String,String> getHeaders()
      Description copied from interface: IDownloadManager.IRequest
      Gets the list of headers to the send in HTTP request.
      Specified by:
      getHeaders in interface IDownloadManager.IRequest
      Returns:
      null or a list of name/value pairs
    • setHeaders

      public 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.
      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 interface IDownloadManager.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 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 interface IDownloadManager.IRequest
      Returns:
      the download title to be displayed in the notification.
    • setTitle

      public DownloadManager.Request setTitle(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 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 interface IDownloadManager.IRequest
      Returns:
      the description of this download
    • setDescription

      public 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.
      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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 interface IDownloadManager.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 - a IDownloadManager.IRequest.Visibility constant.
      Returns:
      this object.