public class VdoDownloadManager
extends java.lang.Object
New download requests can be added which will remain in queue and downloaded serially.
Status of media downloads can be requested using filtered queries.
Download events can be listened to by registering a listener with the VdoDownloadManager instance. Make sure to unregister listener when not required to avoid memory leaks.
| Modifier and Type | Class and Description |
|---|---|
static interface |
VdoDownloadManager.EventListener
Callback interface for listening to download events.
|
static class |
VdoDownloadManager.Query
Class used to specify filters for a query.
|
static interface |
VdoDownloadManager.QueryResultListener
Callback interface for listening to query results.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
ERROR_CANNOT_RESUME |
static int |
ERROR_DATABASE |
static int |
ERROR_DEVICE_NOT_FOUND |
static int |
ERROR_DOWNLOAD_MANAGER |
static int |
ERROR_DRM |
static int |
ERROR_FILE_ALREADY_EXISTS |
static int |
ERROR_FILE_ERROR |
static int |
ERROR_FILE_PERMISSION_DENIED |
static int |
ERROR_HTTP_DATA_ERROR |
static int |
ERROR_INSUFFICIENT_SPACE |
static int |
ERROR_INVALID_DOWNLOAD_SPEC |
static int |
ERROR_LICENSE |
static int |
ERROR_SERVER_DENIED |
static int |
ERROR_SERVER_ERROR |
static int |
ERROR_TOO_MANY_REDIRECTS |
static int |
ERROR_UNHANDLED_HTTP_CODE |
static int |
ERROR_UNKNOWN |
static int |
PAUSED_EXPLICIT |
static int |
PAUSED_QUEUED_FOR_WIFI |
static int |
PAUSED_UNKNOWN |
static int |
PAUSED_WAITING_FOR_NETWORK |
static int |
PAUSED_WAITING_TO_RETRY |
static int |
STATUS_COMPLETED |
static int |
STATUS_DOWNLOADING |
static int |
STATUS_FAILED |
static int |
STATUS_NOT_FOUND |
static int |
STATUS_PAUSED |
static int |
STATUS_PENDING |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(VdoDownloadManager.EventListener listener)
Add a listener for download events.
|
void |
enqueue(DownloadRequest request)
Enqueue a request to be downloaded.
|
static VdoDownloadManager |
getInstance(Context context)
Get an instance of
VdoDownloadManager. |
void |
query(VdoDownloadManager.Query query,
VdoDownloadManager.QueryResultListener queryResultListener)
Query the VdoDownloadManager about media downloads that have been requested.
|
void |
remove(java.lang.String... mediaIds)
Cancel media downloads and delete them locally.
|
void |
removeEventListener(VdoDownloadManager.EventListener listener)
Remove a listener of download events.
|
public static final int STATUS_NOT_FOUND
public static final int STATUS_PENDING
public static final int STATUS_DOWNLOADING
public static final int STATUS_PAUSED
public static final int STATUS_COMPLETED
public static final int STATUS_FAILED
public static final int PAUSED_EXPLICIT
public static final int PAUSED_QUEUED_FOR_WIFI
public static final int PAUSED_UNKNOWN
public static final int PAUSED_WAITING_FOR_NETWORK
public static final int PAUSED_WAITING_TO_RETRY
public static final int ERROR_UNKNOWN
public static final int ERROR_CANNOT_RESUME
public static final int ERROR_INVALID_DOWNLOAD_SPEC
public static final int ERROR_DOWNLOAD_MANAGER
public static final int ERROR_UNHANDLED_HTTP_CODE
public static final int ERROR_SERVER_DENIED
public static final int ERROR_SERVER_ERROR
public static final int ERROR_HTTP_DATA_ERROR
public static final int ERROR_TOO_MANY_REDIRECTS
public static final int ERROR_FILE_ERROR
public static final int ERROR_DEVICE_NOT_FOUND
public static final int ERROR_FILE_ALREADY_EXISTS
public static final int ERROR_INSUFFICIENT_SPACE
public static final int ERROR_FILE_PERMISSION_DENIED
public static final int ERROR_DATABASE
public static final int ERROR_LICENSE
public static final int ERROR_DRM
public static VdoDownloadManager getInstance(Context context)
VdoDownloadManager.context - a Contextjava.lang.RuntimeException - if Build.VERSION#SDK_INT is lower than 21 (Lollipop)public void addEventListener(VdoDownloadManager.EventListener listener)
public void removeEventListener(VdoDownloadManager.EventListener listener)
public void enqueue(DownloadRequest request)
request - a download requestjava.lang.IllegalArgumentException - if the provided download path is not an existing directory
on external storage or if the request is invalidjava.lang.IllegalStateException - if the external storage is not mounted in read and write modepublic void query(VdoDownloadManager.Query query, VdoDownloadManager.QueryResultListener queryResultListener)
VdoDownloadManager.QueryResultListener.query - a query specifying filtersqueryResultListener - a listener for the query resultspublic void remove(java.lang.String... mediaIds)
mediaIds - mediaIds for media to be removed