Class RequestConfig


  • public class RequestConfig
    extends java.lang.Object
    A configuration class whose values are passed over to the DownloadManager in each request made.
    • Field Detail

      • VISIBILITY_VISIBLE_NOTIFY_COMPLETED

        public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED
        See Also:
        Constant Field Values
      • VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION

        public static final int VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION
        See Also:
        Constant Field Values
    • Constructor Detail

      • RequestConfig

        public RequestConfig()
    • Method Detail

      • getDownloadPath

        @Nullable
        public java.io.File getDownloadPath()
        Gets the current base path that will be used to store the downloaded file(s).
        Returns:
        the download path.
      • setDownloadPath

        public RequestConfig setDownloadPath​(@NonNull
                                             java.io.File downloadPath)

        Sets the base path that must be used to the downloaded file(s).

        Parameters:
        downloadPath - the download path.
        Returns:
        this object
      • getTitle

        public java.lang.String getTitle()
        Gets the request title.
        Returns:
        the title
      • getDescription

        public java.lang.String getDescription()
        Gets the request description.
        Returns:
        the description
      • isMobileDownloadAllowed

        public boolean isMobileDownloadAllowed()
        Returns whether download over a mobile network is allowed. By default is not allowed.
        Returns:
        true if allowed
      • isWifiDownloadAllowed

        public boolean isWifiDownloadAllowed()
        Returns whether download over a WIFI network is allowed. By default is not allowed.
        Returns:
        true if allowed
      • isBluetoothDownloadAllowed

        public boolean isBluetoothDownloadAllowed()
        Returns whether download over a bluetooth network is allowed. By default is not allowed.
        Returns:
        true if allowed
      • isRoamingDownloadAllowed

        public boolean isRoamingDownloadAllowed()
        Returns whether download over a mobile roaming network is allowed. By default is not allowed.
        Returns:
        true if allowed
      • isMeteredDownloadAllowed

        public boolean isMeteredDownloadAllowed()
        Returns whether download over a metered network is allowed. By default is not allowed.
        Returns:
        true if allowed
      • getVideoBitrate

        public int getVideoBitrate()
        Gets the video bitrate configured.
        Returns:
        the video bitrate
      • setTitle

        public RequestConfig setTitle​(java.lang.String title)
        Sets the request title.
        Parameters:
        title - the title
        Returns:
        this object
      • setDescription

        public RequestConfig setDescription​(java.lang.String description)
        Sets the request description.
        Parameters:
        description - the description
        Returns:
        this object
      • setMobileDownloadAllowed

        public RequestConfig setMobileDownloadAllowed​(boolean allowed)
        Sets whether download over mobile network is allowed.
        Parameters:
        allowed - whether mobile download network is allowed
        Returns:
        this object
      • setWifiDownloadAllowed

        public RequestConfig setWifiDownloadAllowed​(boolean allowed)
        Sets whether download over WIFI network is allowed.
        Parameters:
        allowed - whether download WIFI network is allowed
        Returns:
        this object
      • setBluetoothDownloadAllowed

        public RequestConfig setBluetoothDownloadAllowed​(boolean allowed)
        Sets whether download over bluetooth network is allowed.
        Parameters:
        allowed - whether download bluetooth network is allowed
        Returns:
        this object
      • setRoamingDownloadAllowed

        public RequestConfig setRoamingDownloadAllowed​(boolean roamingDownloadAllowed)
        Sets whether download over roaming is allowed.
        Parameters:
        roamingDownloadAllowed - whether roaming is allowed
        Returns:
        this object
      • setMeteredDownloadAllowed

        public RequestConfig setMeteredDownloadAllowed​(boolean meteredDownloadAllowed)
        Sets whether download over metered is allowed.
        Parameters:
        meteredDownloadAllowed - whether metered is allowed
        Returns:
        this object
      • setVideoBitrate

        public RequestConfig setVideoBitrate​(int videoBitrate)
        Sets the video bitrate cap which will be used to determine what rendition will be downloaded. If there's no rendition lower than the video bitrate provided, the next higher will be picked.
        Parameters:
        videoBitrate - the video bitrate
        Returns:
        this object
      • setNotificationVisibility

        public RequestConfig setNotificationVisibility​(int notificationVisibility)
        Sets the notification visibility.
        Parameters:
        notificationVisibility - the notification visibility
        Returns:
        this object
      • copy

        public RequestConfig copy()
        Creates a shallow copy of the current config.
        Returns:
        a shallow copy of the current config.