-
public class RequestConfig
A configuration class whose values are passed over to the android.app.DownloadManager in each request made.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public @interface
RequestConfig.RequestVisibility
List of values that can take the method setNotificationVisibility.
-
Field Summary
Fields Modifier and Type Field Description public final static int
VISIBILITY_VISIBLE
public final static int
VISIBILITY_VISIBLE_NOTIFY_COMPLETED
public final static int
VISIBILITY_HIDDEN
public final static int
VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION
public final static int
DEFAULT_VIDEO_BITRATE
private File
downloadPath
private String
title
private String
description
private boolean
mobileDownloadAllowed
private boolean
wifiDownloadAllowed
private boolean
bluetoothDownloadAllowed
private boolean
roamingDownloadAllowed
private boolean
meteredDownloadAllowed
private int
videoBitrate
private int
notificationVisibility
-
Method Summary
Modifier and Type Method Description File
getDownloadPath()
Gets the current base path that will be used to store the downloaded file(s). RequestConfig
setDownloadPath(@NonNull() File downloadPath)
Sets the base path that must be used to the downloaded file(s). String
getTitle()
Gets the request title. RequestConfig
setTitle(String title)
Sets the request title. String
getDescription()
Gets the request description. RequestConfig
setDescription(String description)
Sets the request description. RequestConfig
setMobileDownloadAllowed(boolean allowed)
Sets whether download over mobile network is allowed. RequestConfig
setWifiDownloadAllowed(boolean allowed)
Sets whether download over WIFI network is allowed. RequestConfig
setBluetoothDownloadAllowed(boolean allowed)
Sets whether download over bluetooth network is allowed. RequestConfig
setRoamingDownloadAllowed(boolean roamingDownloadAllowed)
Sets whether download over roaming is allowed. RequestConfig
setMeteredDownloadAllowed(boolean meteredDownloadAllowed)
Sets whether download over metered is allowed. int
getVideoBitrate()
Gets the video bitrate configured. 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. int
getNotificationVisibility()
Returns the notification visibility. RequestConfig
setNotificationVisibility(int notificationVisibility)
Sets the notification visibility. boolean
isMobileDownloadAllowed()
Returns whether download over a mobile network is allowed.By default is not allowed. boolean
isWifiDownloadAllowed()
Returns whether download over a WIFI network is allowed.By default is not allowed. boolean
isBluetoothDownloadAllowed()
Returns whether download over a bluetooth network is allowed.By default is not allowed. boolean
isRoamingDownloadAllowed()
Returns whether download over a mobile roaming network is allowed.By default is not allowed. boolean
isMeteredDownloadAllowed()
Returns whether download over a metered network is allowed.By default is not allowed. RequestConfig
copy()
Creates a shallow copy of the current config. -
-
Method Detail
-
getDownloadPath
@Nullable() File getDownloadPath()
Gets the current base path that will be used to store the downloaded file(s).
-
setDownloadPath
RequestConfig setDownloadPath(@NonNull() File downloadPath)
Sets the base path that must be used to the downloaded file(s).
- Parameters:
downloadPath
- the download path.
-
setTitle
RequestConfig setTitle(String title)
Sets the request title.
- Parameters:
title
- the title
-
getDescription
String getDescription()
Gets the request description.
-
setDescription
RequestConfig setDescription(String description)
Sets the request description.
- Parameters:
description
- the description
-
setMobileDownloadAllowed
RequestConfig setMobileDownloadAllowed(boolean allowed)
Sets whether download over mobile network is allowed.
- Parameters:
allowed
- whether mobile download network is allowed
-
setWifiDownloadAllowed
RequestConfig setWifiDownloadAllowed(boolean allowed)
Sets whether download over WIFI network is allowed.
- Parameters:
allowed
- whether download WIFI network is allowed
-
setBluetoothDownloadAllowed
RequestConfig setBluetoothDownloadAllowed(boolean allowed)
Sets whether download over bluetooth network is allowed.
- Parameters:
allowed
- whether download bluetooth network is allowed
-
setRoamingDownloadAllowed
RequestConfig setRoamingDownloadAllowed(boolean roamingDownloadAllowed)
Sets whether download over roaming is allowed.
- Parameters:
roamingDownloadAllowed
- whether roaming is allowed
-
setMeteredDownloadAllowed
RequestConfig setMeteredDownloadAllowed(boolean meteredDownloadAllowed)
Sets whether download over metered is allowed.
- Parameters:
meteredDownloadAllowed
- whether metered is allowed
-
getVideoBitrate
int getVideoBitrate()
Gets the video bitrate configured.
-
setVideoBitrate
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
-
getNotificationVisibility
int getNotificationVisibility()
Returns the notification visibility.It can have the following values: VISIBILITY_HIDDEN, VISIBILITY_VISIBLE, VISIBILITY_VISIBLE_NOTIFY_COMPLETED and VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION
-
setNotificationVisibility
RequestConfig setNotificationVisibility(int notificationVisibility)
Sets the notification visibility.
- Parameters:
notificationVisibility
- the notification visibility
-
isMobileDownloadAllowed
boolean isMobileDownloadAllowed()
Returns whether download over a mobile network is allowed.By default is not allowed.
-
isWifiDownloadAllowed
boolean isWifiDownloadAllowed()
Returns whether download over a WIFI network is allowed.By default is not allowed.
-
isBluetoothDownloadAllowed
boolean isBluetoothDownloadAllowed()
Returns whether download over a bluetooth network is allowed.By default is not allowed.
-
isRoamingDownloadAllowed
boolean isRoamingDownloadAllowed()
Returns whether download over a mobile roaming network is allowed.By default is not allowed.
-
isMeteredDownloadAllowed
boolean isMeteredDownloadAllowed()
Returns whether download over a metered network is allowed.By default is not allowed.
-
copy
RequestConfig copy()
Creates a shallow copy of the current config.
-
-
-
-