Build 1.0_r1(from source)

android.provider
Class Downloads

java.lang.Object
  extended by android.provider.Downloads
All Implemented Interfaces:
BaseColumns

public final class Downloads
extends Object
implements BaseColumns

Exposes constants used to interact with the download manager's content provider. The constants URI ... STATUS are the names of columns in the downloads table.


Field Summary
static Uri CONTENT_URI
          The content:// URI for the data table in the provider
static String CONTROL
          The name of the column containing the command associated with the download.
static int CONTROL_PAUSE
          This download must pause (might be restarted)
static int CONTROL_RUN
          This download can run
static int CONTROL_STOP
          This download must abort (will never be restarted)
static String COOKIE_DATA
          The name of the column contain the values of the cookie to be used for the download.
static String CURRENT_BYTES
          The name of the column containing the size of the part of the file that has been downloaded so far.
static String DESCRIPTION
          The name of the column where the initiating application can provide the description of this download.
static String DESTINATION
          The name of the column containing the flag that controls the destination of the download.
static int DESTINATION_CACHE_PARTITION
          This download will be saved to the download manager's private partition.
static int DESTINATION_CACHE_PARTITION_PURGEABLE
          This download will be saved to the download manager's private partition and will be purged as necessary to make space.
static int DESTINATION_DATA_CACHE
          This download will be saved to the download manager's cache on the shared data partition.
static int DESTINATION_EXTERNAL
          This download will be saved to the external storage.
static String DOWNLOAD_COMPLETED_ACTION
          Broadcast Action: this is sent by the download manager to the app that had initiated a download when that download completes.
static String ENTITY
          The name of the column containing the entity to be sent with the request of this download.
static String ETAG
          The name of the column containing the entity tag for the response.
static String FAILED_CONNECTIONS
          The name of the column containing the number of consecutive connections that have failed.
static String FILENAME
          The name of the column containing the filename where the downloaded data was actually stored.
static String FILENAME_HINT
          The name of the column containing the filename that the initiating application recommends.
static String LAST_MODIFICATION
          The name of the column containing the date at which some interesting status changed in the download.
static String MEDIA_SCANNED
          The name of the column where the download manager indicates whether the media scanner was notified about this download.
static String METHOD
          The name of the column containing the HTTP method to use for this download.
static int METHOD_GET
          GET
static int METHOD_POST
          POST
static String MIMETYPE
          The name of the column containing the MIME type of the downloaded data.
static String NO_INTEGRITY
          The name of the column containing the flags that indicates whether the initiating application is capable of verifying the integrity of the downloaded file.
static String NO_SYSTEM_FILES
          The name of the columns containing the flag that controls whether files with private/inernal/system MIME types can be downloaded.
static String NOTIFICATION_CLASS
          The name of the column containing the component name of the class that will receive notifications associated with the download.
static String NOTIFICATION_CLICKED_ACTION
          Broadcast Action: this is sent by the download manager to the app that had initiated a download when the user selects the notification associated with that download.
static String NOTIFICATION_EXTRAS
          If extras are specified when requesting a download they will be provided in the intent that is sent to the specified class and package when a download has finished.
static String NOTIFICATION_PACKAGE
          The name of the column containing the package name of the application that initiating the download.
static String OTA_UPDATE
          The name of the column containing the flags that controls whether the download must be saved with the filename used for OTA updates.
static String OTHER_UID
          The name of the column where the initiating application can provide the UID of another application that is allowed to access this download.
static String REFERER
          The name of the column containing the referer (sic) that the initiating application wants the download manager to use for this download.
static String STATUS
          The name of the column containing the current status of the download.
static int STATUS_BAD_REQUEST
          This request couldn't be parsed.
static int STATUS_CANCELED
          This download was canceled
static int STATUS_CANCELLED
           
static int STATUS_ERROR
           
static int STATUS_FILE_ERROR
          This download couldn't be completed because of a storage issue.
static int STATUS_HTTP_DATA_ERROR
          This download couldn't be completed because of an error receiving or processing data at the HTTP level.
static int STATUS_HTTP_EXCEPTION
          This download couldn't be completed because of an HttpException while setting up the request.
static int STATUS_LENGTH_REQUIRED
          This download cannot be performed because the length cannot be determined accurately.
static int STATUS_NOT_ACCEPTABLE
          This download can't be performed because the content type cannot be handled.
static int STATUS_NOT_AUTHORIZED
          The server returned an auth error.
static int STATUS_PENDING
          This download hasn't stated yet
static int STATUS_PENDING_PAUSED
          This download hasn't stated yet and is paused
static int STATUS_PRECONDITION_FAILED
          This download was interrupted and cannot be resumed.
static int STATUS_RUNNING
          This download has started
static int STATUS_RUNNING_PAUSED
          This download has started and is paused
static int STATUS_SUCCESS
          This download has successfully completed.
static int STATUS_UNHANDLED_HTTP_CODE
          This download couldn't be completed because of an unspecified unhandled HTTP code.
static int STATUS_UNHANDLED_REDIRECT
          This download couldn't be completed because of an HTTP redirect code.
static int STATUS_UNKNOWN_ERROR
          This download has completed with an error.
static String TITLE
          The name of the column where the initiating application can provided the title of this download.
static String TOTAL_BYTES
          The name of the column containing the total size of the file being downloaded.
static String UID
          The name of the column containing the UID of the application that initiated the download.
static String URI
          The name of the column containing the URI of the data being downloaded.
static String USER_AGENT
          The name of the column containing the user agent that the initiating application wants the download manager to use for this download.
static String VISIBILITY
          The name of the column containing the flags that controls whether the download is displayed by the UI.
static int VISIBILITY_HIDDEN
          This download doesn't show in the UI or in the notifications.
static int VISIBILITY_VISIBLE
          This download is visible but only shows in the notifications while it's running (a separate download UI would still show it after completion).
static int VISIBILITY_VISIBLE_NOTIFY_COMPLETED
          This download is visible and shows in the notifications after completion.
 
Fields inherited from interface android.provider.BaseColumns
_COUNT, _ID
 
Method Summary
static boolean isStatusClientError(int status)
          Returns whether the status is a client error (i.e.
static boolean isStatusCompleted(int status)
          Returns whether the download has completed (either with success or error).
static boolean isStatusError(int status)
          Returns whether the status is an error (i.e.
static boolean isStatusInformational(int status)
          Returns whether the status is informational (i.e.
static boolean isStatusServerError(int status)
          Returns whether the status is a server error (i.e.
static boolean isStatusSuccess(int status)
          Returns whether the status is a success (i.e.
static boolean isStatusSuspended(int status)
          Returns whether the download is suspended.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTENT_URI

public static final Uri CONTENT_URI
The content:// URI for the data table in the provider


DOWNLOAD_COMPLETED_ACTION

public static final String DOWNLOAD_COMPLETED_ACTION
Broadcast Action: this is sent by the download manager to the app that had initiated a download when that download completes. The download's content: uri is specified in the intent's data.

See Also:
Constant Field Values

NOTIFICATION_CLICKED_ACTION

public static final String NOTIFICATION_CLICKED_ACTION
Broadcast Action: this is sent by the download manager to the app that had initiated a download when the user selects the notification associated with that download. The download's content: uri is specified in the intent's data if the click is associated with a single download, or Downloads.CONTENT_URI if the notification is associated with multiple downloads. Note: this is not currently sent for downloads that have completed successfully.

See Also:
Constant Field Values

URI

public static final String URI
The name of the column containing the URI of the data being downloaded.

Type: TEXT

Owner can Init/Read

See Also:
Constant Field Values

METHOD

public static final String METHOD
The name of the column containing the HTTP method to use for this download. See the METHOD_* constants for a list of legal values.

Type: INTEGER

Owner can Init/Read

See Also:
Constant Field Values

ENTITY

public static final String ENTITY
The name of the column containing the entity to be sent with the request of this download. Only use for methods that support sending entities, i.e. POST.

Type: TEXT

Owner can Init

See Also:
Constant Field Values

NO_INTEGRITY

public static final String NO_INTEGRITY
The name of the column containing the flags that indicates whether the initiating application is capable of verifying the integrity of the downloaded file. When this flag is set, the download manager performs downloads and reports success even in some situations where it can't guarantee that the download has completed (e.g. when doing a byte-range request without an ETag, or when it can't determine whether a download fully completed).

Type: BOOLEAN

Owner can Init/Read

See Also:
Constant Field Values

FILENAME_HINT

public static final String FILENAME_HINT
The name of the column containing the filename that the initiating application recommends. When possible, the download manager will attempt to use this filename, or a variation, as the actual name for the file.

Type: TEXT

Owner can Init/Read

See Also:
Constant Field Values

FILENAME

public static final String FILENAME
The name of the column containing the filename where the downloaded data was actually stored.

Type: TEXT

Owner can Read

UI can Read

See Also:
Constant Field Values

MIMETYPE

public static final String MIMETYPE
The name of the column containing the MIME type of the downloaded data.

Type: TEXT

Owner can Init/Read

UI can Read

See Also:
Constant Field Values

DESTINATION

public static final String DESTINATION
The name of the column containing the flag that controls the destination of the download. See the DESTINATION_* constants for a list of legal values.

Type: INTEGER

Owner can Init/Read

UI can Read

See Also:
Constant Field Values

OTA_UPDATE

public static final String OTA_UPDATE
The name of the column containing the flags that controls whether the download must be saved with the filename used for OTA updates. Must be used with INTERNAL, and the initiating application must hold the android.permission.DOWNLOAD_OTA_UPDATE permission.

Type: BOOLEAN

Owner can Init/Read

UI can Read

See Also:
Constant Field Values

NO_SYSTEM_FILES

public static final String NO_SYSTEM_FILES
The name of the columns containing the flag that controls whether files with private/inernal/system MIME types can be downloaded.

Type: BOOLEAN

Owner can Init/Read

See Also:
Constant Field Values

VISIBILITY

public static final String VISIBILITY
The name of the column containing the flags that controls whether the download is displayed by the UI. See the VISIBILITY_* constants for a list of legal values.

Type: INTEGER

Owner can Init/Read/Write

UI can Read/Write (only for entries that are visible)

See Also:
Constant Field Values

CONTROL

public static final String CONTROL
The name of the column containing the command associated with the download. After a download is initiated, this is the only column that applications can modify. See the CONTROL_* constants for a list of legal values. Note: doesn't do anything in 1.0. The API will be hooked up in a future version, and is provided here as an indication of things to come.

Type: INTEGER

Owner can Init/Read/Write

UI can Init/Read/Write

See Also:
Constant Field Values

STATUS

public static final String STATUS
The name of the column containing the current status of the download. Applications can read this to follow the progress of each download. See the STATUS_* constants for a list of legal values.

Type: INTEGER

Owner can Read

UI can Read

See Also:
Constant Field Values

LAST_MODIFICATION

public static final String LAST_MODIFICATION
The name of the column containing the date at which some interesting status changed in the download. Stored as a System.currentTimeMillis() value.

Type: BIGINT

Owner can Read

UI can Read

See Also:
Constant Field Values

FAILED_CONNECTIONS

public static final String FAILED_CONNECTIONS
The name of the column containing the number of consecutive connections that have failed.

Type: INTEGER

See Also:
Constant Field Values

NOTIFICATION_PACKAGE

public static final String NOTIFICATION_PACKAGE
The name of the column containing the package name of the application that initiating the download. The download manager will send notifications to a component in this package when the download completes.

Type: TEXT

Owner can Init/Read

UI can Read

See Also:
Constant Field Values

NOTIFICATION_CLASS

public static final String NOTIFICATION_CLASS
The name of the column containing the component name of the class that will receive notifications associated with the download. The package/class combination is passed to Intent.setClassName(String,String).

Type: TEXT

Owner can Init/Read

UI can Read

See Also:
Constant Field Values

NOTIFICATION_EXTRAS

public static final String NOTIFICATION_EXTRAS
If extras are specified when requesting a download they will be provided in the intent that is sent to the specified class and package when a download has finished.

See Also:
Constant Field Values

COOKIE_DATA

public static final String COOKIE_DATA
The name of the column contain the values of the cookie to be used for the download. This is used directly as the value for the Cookie: HTTP header that gets sent with the request.

Type: TEXT

Owner can Init

See Also:
Constant Field Values

USER_AGENT

public static final String USER_AGENT
The name of the column containing the user agent that the initiating application wants the download manager to use for this download.

Type: TEXT

Owner can Init

See Also:
Constant Field Values

REFERER

public static final String REFERER
The name of the column containing the referer (sic) that the initiating application wants the download manager to use for this download.

Type: TEXT

Owner can Init

See Also:
Constant Field Values

TOTAL_BYTES

public static final String TOTAL_BYTES
The name of the column containing the total size of the file being downloaded.

Type: INTEGER

Owner can Read

UI can Read

See Also:
Constant Field Values

CURRENT_BYTES

public static final String CURRENT_BYTES
The name of the column containing the size of the part of the file that has been downloaded so far.

Type: INTEGER

Owner can Read

UI can Read

See Also:
Constant Field Values

ETAG

public static final String ETAG
The name of the column containing the entity tag for the response.

Type: TEXT

See Also:
Constant Field Values

UID

public static final String UID
The name of the column containing the UID of the application that initiated the download.

Type: INTEGER

See Also:
Constant Field Values

OTHER_UID

public static final String OTHER_UID
The name of the column where the initiating application can provide the UID of another application that is allowed to access this download. If multiple applications share the same UID, all those applications will be allowed to access this download. This column can be updated after the download is initiated.

Type: INTEGER

Owner can Init/Read/Write

See Also:
Constant Field Values

TITLE

public static final String TITLE
The name of the column where the initiating application can provided the title of this download. The title will be displayed ito the user in the list of downloads.

Type: TEXT

Owner can Init/Read/Write

UI can Read

See Also:
Constant Field Values

DESCRIPTION

public static final String DESCRIPTION
The name of the column where the initiating application can provide the description of this download. The description will be displayed to the user in the list of downloads.

Type: TEXT

Owner can Init/Read/Write

UI can Read

See Also:
Constant Field Values

MEDIA_SCANNED

public static final String MEDIA_SCANNED
The name of the column where the download manager indicates whether the media scanner was notified about this download.

Type: BOOLEAN

See Also:
Constant Field Values

DESTINATION_EXTERNAL

public static final int DESTINATION_EXTERNAL
This download will be saved to the external storage. This is the default behavior, and should be used for any file that the user can freely access, copy, delete. Even with that destination, unencrypted DRM files are saved in secure internal storage. Downloads to the external destination only write files for which there is a registered handler. The resulting files are accessible by filename to all applications.

See Also:
Constant Field Values

DESTINATION_CACHE_PARTITION

public static final int DESTINATION_CACHE_PARTITION
This download will be saved to the download manager's private partition. This is the behavior used by applications that want to download private files that are used and deleted soon after they get downloaded. All file types are allowed, and only the initiating application can access the file (indirectly through a content provider).

See Also:
Constant Field Values

DESTINATION_CACHE_PARTITION_PURGEABLE

public static final int DESTINATION_CACHE_PARTITION_PURGEABLE
This download will be saved to the download manager's private partition and will be purged as necessary to make space. This is for private files (similar to CACHE_PARTITION) that aren't deleted immediately after they are used, and are kept around by the download manager as long as space is available.

See Also:
Constant Field Values

DESTINATION_DATA_CACHE

public static final int DESTINATION_DATA_CACHE
This download will be saved to the download manager's cache on the shared data partition. Use CACHE_PARTITION_PURGEABLE instead.

See Also:
Constant Field Values

CONTROL_RUN

public static final int CONTROL_RUN
This download can run

See Also:
Constant Field Values

CONTROL_PAUSE

public static final int CONTROL_PAUSE
This download must pause (might be restarted)

See Also:
Constant Field Values

CONTROL_STOP

public static final int CONTROL_STOP
This download must abort (will never be restarted)

See Also:
Constant Field Values

STATUS_PENDING

public static final int STATUS_PENDING
This download hasn't stated yet

See Also:
Constant Field Values

STATUS_PENDING_PAUSED

public static final int STATUS_PENDING_PAUSED
This download hasn't stated yet and is paused

See Also:
Constant Field Values

STATUS_RUNNING

public static final int STATUS_RUNNING
This download has started

See Also:
Constant Field Values

STATUS_RUNNING_PAUSED

public static final int STATUS_RUNNING_PAUSED
This download has started and is paused

See Also:
Constant Field Values

STATUS_SUCCESS

public static final int STATUS_SUCCESS
This download has successfully completed. Warning: there might be other status values that indicate success in the future. Use isSucccess() to capture the entire category.

See Also:
Constant Field Values

STATUS_BAD_REQUEST

public static final int STATUS_BAD_REQUEST
This request couldn't be parsed. This is also used when processing requests with unknown/unsupported URI schemes.

See Also:
Constant Field Values

STATUS_NOT_AUTHORIZED

public static final int STATUS_NOT_AUTHORIZED
The server returned an auth error.

See Also:
Constant Field Values

STATUS_NOT_ACCEPTABLE

public static final int STATUS_NOT_ACCEPTABLE
This download can't be performed because the content type cannot be handled.

See Also:
Constant Field Values

STATUS_LENGTH_REQUIRED

public static final int STATUS_LENGTH_REQUIRED
This download cannot be performed because the length cannot be determined accurately. This is the code for the HTTP error "Length Required", which is typically used when making requests that require a content length but don't have one, and it is also used in the client when a response is received whose length cannot be determined accurately (therefore making it impossible to know when a download completes).

See Also:
Constant Field Values

STATUS_PRECONDITION_FAILED

public static final int STATUS_PRECONDITION_FAILED
This download was interrupted and cannot be resumed. This is the code for the HTTP error "Precondition Failed", and it is also used in situations where the client doesn't have an ETag at all.

See Also:
Constant Field Values

STATUS_CANCELED

public static final int STATUS_CANCELED
This download was canceled

See Also:
Constant Field Values

STATUS_CANCELLED

public static final int STATUS_CANCELLED
See Also:
Constant Field Values

STATUS_UNKNOWN_ERROR

public static final int STATUS_UNKNOWN_ERROR
This download has completed with an error. Warning: there will be other status values that indicate errors in the future. Use isStatusError() to capture the entire category.

See Also:
Constant Field Values

STATUS_ERROR

public static final int STATUS_ERROR
See Also:
Constant Field Values

STATUS_FILE_ERROR

public static final int STATUS_FILE_ERROR
This download couldn't be completed because of a storage issue. Typically, that's because the filesystem is missing or full.

See Also:
Constant Field Values

STATUS_UNHANDLED_REDIRECT

public static final int STATUS_UNHANDLED_REDIRECT
This download couldn't be completed because of an HTTP redirect code.

See Also:
Constant Field Values

STATUS_UNHANDLED_HTTP_CODE

public static final int STATUS_UNHANDLED_HTTP_CODE
This download couldn't be completed because of an unspecified unhandled HTTP code.

See Also:
Constant Field Values

STATUS_HTTP_DATA_ERROR

public static final int STATUS_HTTP_DATA_ERROR
This download couldn't be completed because of an error receiving or processing data at the HTTP level.

See Also:
Constant Field Values

STATUS_HTTP_EXCEPTION

public static final int STATUS_HTTP_EXCEPTION
This download couldn't be completed because of an HttpException while setting up the request.

See Also:
Constant Field Values

METHOD_GET

public static final int METHOD_GET
GET

See Also:
Constant Field Values

METHOD_POST

public static final int METHOD_POST
POST

See Also:
Constant Field Values

VISIBILITY_VISIBLE

public static final int VISIBILITY_VISIBLE
This download is visible but only shows in the notifications while it's running (a separate download UI would still show it after completion).

See Also:
Constant Field Values

VISIBILITY_VISIBLE_NOTIFY_COMPLETED

public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED
This download is visible and shows in the notifications after completion.

See Also:
Constant Field Values

VISIBILITY_HIDDEN

public static final int VISIBILITY_HIDDEN
This download doesn't show in the UI or in the notifications.

See Also:
Constant Field Values
Method Detail

isStatusInformational

public static boolean isStatusInformational(int status)
Returns whether the status is informational (i.e. 1xx).


isStatusSuspended

public static boolean isStatusSuspended(int status)
Returns whether the download is suspended. (i.e. whether the download won't complete without some action from outside the download manager).


isStatusSuccess

public static boolean isStatusSuccess(int status)
Returns whether the status is a success (i.e. 2xx).


isStatusError

public static boolean isStatusError(int status)
Returns whether the status is an error (i.e. 4xx or 5xx).


isStatusClientError

public static boolean isStatusClientError(int status)
Returns whether the status is a client error (i.e. 4xx).


isStatusServerError

public static boolean isStatusServerError(int status)
Returns whether the status is a server error (i.e. 5xx).


isStatusCompleted

public static boolean isStatusCompleted(int status)
Returns whether the download has completed (either with success or error).


Build 1.0_r1(from source)

Please submit a feedback, bug or feature