Package 

Class DownloadManager.Request

    • Constructor Detail

      • DownloadManager.Request

        DownloadManager.Request(Uri remoteUri)
        Constructs a new download request.
        Parameters:
        remoteUri - the URL to the remote file.
      • DownloadManager.Request

        DownloadManager.Request(Uri remoteUri, Uri localUri)
        Constructs a new download request.
        Parameters:
        remoteUri - the URL to the remote file.
        localUri - the local destination for the downloaded 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.

      • 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.
      • 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.
      • 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.