public final class Download extends Object
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
Download.FailureReason |
Failure reasons.
|
static interface |
Download.State |
Download states.
|
| Modifier and Type | Field | Description |
|---|---|---|
long |
contentLength |
The total size of the content in bytes, or
C.LENGTH_UNSET if unknown. |
static int |
FAILURE_REASON_NONE |
The download isn't failed.
|
static int |
FAILURE_REASON_UNKNOWN |
The download is failed because of unknown reason.
|
int |
failureReason |
|
DownloadRequest |
request |
The download request.
|
long |
startTimeMs |
The first time when download entry is created.
|
int |
state |
The state of the download.
|
static int |
STATE_COMPLETED |
The download completed.
|
static int |
STATE_DOWNLOADING |
The download is currently started.
|
static int |
STATE_FAILED |
The download failed.
|
static int |
STATE_QUEUED |
The download is waiting to be started.
|
static int |
STATE_REMOVING |
The download is being removed.
|
static int |
STATE_RESTARTING |
The download will restart after all downloaded data is removed.
|
static int |
STATE_STOPPED |
The download is stopped for a specified
stopReason. |
static int |
STOP_REASON_NONE |
The download isn't stopped.
|
int |
stopReason |
The reason the download is stopped, or
STOP_REASON_NONE. |
long |
updateTimeMs |
The last update time.
|
| Constructor | Description |
|---|---|
Download(DownloadRequest request,
int state,
long startTimeMs,
long updateTimeMs,
long contentLength,
int stopReason,
int failureReason) |
|
Download(DownloadRequest request,
int state,
long startTimeMs,
long updateTimeMs,
long contentLength,
int stopReason,
int failureReason,
DownloadProgress progress) |
| Modifier and Type | Method | Description |
|---|---|---|
long |
getBytesDownloaded() |
Returns the total number of downloaded bytes.
|
float |
getPercentDownloaded() |
Returns the estimated download percentage, or
C.PERCENTAGE_UNSET if no estimate is
available. |
boolean |
isTerminalState() |
Returns whether the download is completed or failed.
|
public static final int STATE_QUEUED
DownloadManager
paused
Requirements that are not met
maxParallelDownloads
public static final int STATE_STOPPED
stopReason.public static final int STATE_DOWNLOADING
public static final int STATE_COMPLETED
public static final int STATE_FAILED
public static final int STATE_REMOVING
public static final int STATE_RESTARTING
public static final int FAILURE_REASON_NONE
public static final int FAILURE_REASON_UNKNOWN
public static final int STOP_REASON_NONE
public final DownloadRequest request
@State public final int state
public final long startTimeMs
public final long updateTimeMs
public final long contentLength
C.LENGTH_UNSET if unknown.public final int stopReason
STOP_REASON_NONE.@FailureReason public final int failureReason
public Download(DownloadRequest request, @State int state, long startTimeMs, long updateTimeMs, long contentLength, int stopReason, @FailureReason int failureReason)
public Download(DownloadRequest request, @State int state, long startTimeMs, long updateTimeMs, long contentLength, int stopReason, @FailureReason int failureReason, DownloadProgress progress)
public boolean isTerminalState()
public long getBytesDownloaded()
public float getPercentDownloaded()
C.PERCENTAGE_UNSET if no estimate is
available.