public class DownloadStatus
extends java.lang.Object
implements android.os.Parcelable
Modifier and Type | Class and Description |
---|---|
static interface |
DownloadStatus.ReasonCode
The list of possible reasons code that will be set when
DownloadStatus.StatusCode is either
STATUS_RETRY or STATUS_FAILED . |
static interface |
DownloadStatus.StatusCode
The list of possible status values for
DownloadManager.Request . |
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<DownloadStatus> |
CREATOR
Provides a creator field as required by the
Parcelable contract. |
static int |
ERROR_CANNOT_RESUME
The download has failed because some possibly transient error occurred but prevents
resuming the download.
|
static int |
ERROR_DEVICE_NOT_FOUND
The download has failed because no external storage device was found.
|
static int |
ERROR_FILE_ALREADY_EXISTS
The download has failed because the requested destination file already exists.
|
static int |
ERROR_FILE_ERROR
The download has failed because of storage issue which doesn't fit under any
other error code.
|
static int |
ERROR_HTTP_DATA_ERROR
The download has failed because an error occurred while receiving or processing data at
the HTTP level.
|
static int |
ERROR_INSUFFICIENT_SPACE
The download has failed because there was insufficient storage space.
|
static int |
ERROR_NONE
There are no errors in the download request.
|
static int |
ERROR_TOO_MANY_REDIRECTS
The download has failed because there were too many redirects.
|
static int |
ERROR_UNHANDLED_HTTP_CODE
The download has failed because an HTTP code was received that cannot be handled.
|
static int |
ERROR_UNKNOWN
The download has failed with an error that doesn't fit under any other error code.
|
static int |
PAUSED_QUEUED_FOR_WIFI
The download exceeds a size limit for downloads over the mobile network and the
download manager is waiting for a Wi-Fi connection to proceed.
|
static int |
PAUSED_UNKNOWN
The download is paused for some other reason.
|
static int |
PAUSED_WAITING_FOR_NETWORK
The download is waiting for network connectivity to proceed.
|
static int |
PAUSED_WAITING_TO_RETRY
The download is paused because some network error occurred and the download manager is
waiting before retrying the request.
|
static int |
STATUS_CANCELLING
Status of
DownloadManager.Request that is being removed before the
download is complete. |
static int |
STATUS_COMPLETE
Status of
DownloadManager.Request that has successfully downloaded. |
static int |
STATUS_DELETING
Status of
DownloadManager.Request that is being removed after the
download is complete. |
static int |
STATUS_DOWNLOADING
Status of
DownloadManager.Request that is currently being downloaded. |
static int |
STATUS_FAILED
Status of
DownloadManager.Request that has failed (and will not be retried). |
static int |
STATUS_NOT_QUEUED
Status of
DownloadManager.Request that has been not queued for download. |
static int |
STATUS_PAUSED
Status of
DownloadManager.Request that has been paused explicitly. |
static int |
STATUS_PENDING
Status of
DownloadManager.Request is waiting to start. |
static int |
STATUS_QUEUEING
Status of
DownloadManager.Request that is being queued with the
DownloadManager service. |
static int |
STATUS_RETRY
Status of
DownloadManager.Request that is currently waiting to retry or resume. |
Constructor and Description |
---|
DownloadStatus() |
Modifier and Type | Method and Description |
---|---|
static DownloadStatus |
createForInvalidDownloadsFile()
Creates a new
DownloadStatus instance with error specifying that the DownloadsFile
is invalid. |
int |
describeContents() |
boolean |
equals(java.lang.Object o) |
long |
getActualSize()
Gets the actual total size of the file as number of bytes.
|
long |
getBytesDownloaded()
Gets the total number of bytes downloaded so far.
|
int |
getCode()
Gets the status code of the download request.
|
long |
getEstimatedSize()
Gets the estimated total size of the file as number of bytes.
|
long |
getMaxSize()
Gets the maximum size of the file as number of bytes by comparing
actualSize and
estimatedSize |
double |
getProgress()
Calculates the download progress as percentage value.
|
int |
getReason()
Gets the reason code of the download request, if any.
|
int |
getReasonMessage()
Converts the current status code the string resourced identifier that explains the status.
|
int |
getStatusMessage()
Converts the current status code to a string resource identifier that explains status.
|
long |
getTime()
Gets the date and time when the status changed as number of milliseconds since
January 1, 1970, 00:00:00 GMT.
|
int |
hashCode() |
boolean |
isMarkedForDeletion()
Checks if the status indicates the download is currently marked for deletion.
|
static int |
toReasonMessage(int reason)
Converts the given reason code to a string resource identifier that explains the reason.
|
static int |
toStatusMessage(int code)
Converts the given status code to a string resource identifier that explains the status.
|
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final int STATUS_PAUSED
DownloadManager.Request
that has been paused explicitly.public static final int STATUS_DELETING
DownloadManager.Request
that is being removed after the
download is complete.public static final int STATUS_CANCELLING
DownloadManager.Request
that is being removed before the
download is complete.public static final int STATUS_QUEUEING
DownloadManager.Request
that is being queued with the
DownloadManager
service.public static final int STATUS_NOT_QUEUED
DownloadManager.Request
that has been not queued for download.public static final int STATUS_PENDING
DownloadManager.Request
is waiting to start.public static final int STATUS_DOWNLOADING
DownloadManager.Request
that is currently being downloaded.public static final int STATUS_RETRY
DownloadManager.Request
that is currently waiting to retry or resume.public static final int STATUS_FAILED
DownloadManager.Request
that has failed (and will not be retried).public static final int STATUS_COMPLETE
DownloadManager.Request
that has successfully downloaded.public static final int ERROR_NONE
public static final int PAUSED_WAITING_TO_RETRY
public static final int PAUSED_WAITING_FOR_NETWORK
public static final int PAUSED_QUEUED_FOR_WIFI
public static final int PAUSED_UNKNOWN
public static final int ERROR_UNKNOWN
public static final int ERROR_FILE_ERROR
ERROR_INSUFFICIENT_SPACE
and
ERROR_DEVICE_NOT_FOUND
when appropriate.public static final int ERROR_UNHANDLED_HTTP_CODE
public static final int ERROR_HTTP_DATA_ERROR
public static final int ERROR_TOO_MANY_REDIRECTS
public static final int ERROR_INSUFFICIENT_SPACE
public static final int ERROR_DEVICE_NOT_FOUND
public static final int ERROR_CANNOT_RESUME
public static final int ERROR_FILE_ALREADY_EXISTS
public static final android.os.Parcelable.Creator<DownloadStatus> CREATOR
Parcelable
contract.public static DownloadStatus createForInvalidDownloadsFile()
DownloadStatus
instance with error specifying that the DownloadsFile
is invalid.STATUS_NOT_QUEUED
,
ERROR_DEVICE_NOT_FOUND
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean isMarkedForDeletion()
public int getStatusMessage()
public static int toStatusMessage(int code)
code
- the status code.public int getReasonMessage()
public static int toReasonMessage(int reason)
reason
- the reason code.public long getTime()
public int getCode()
public int getReason()
public long getBytesDownloaded()
public long getActualSize()
public long getEstimatedSize()
public long getMaxSize()
actualSize
and
estimatedSize
public double getProgress()
Double.NaN
if the actualSize
is zero, otherwise a value between
0 and 100.public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable