/**@class android.app.DownloadManager.Request @extends java.lang.Object This class contains all the information necessary to request a new download. The URI is the only required parameter. Note that the default download destination is a shared volume where the system might delete your file if it needs to reclaim space for system use. If this is a problem, use a location on external storage (see {@link #setDestinationUri}(Uri). */ var Request = { /** Bit flag for {@link #setAllowedNetworkTypes} corresponding to {@link ConnectivityManager#TYPE_MOBILE}. */ NETWORK_MOBILE : "1", /** Bit flag for {@link #setAllowedNetworkTypes} corresponding to {@link ConnectivityManager#TYPE_WIFI}. */ NETWORK_WIFI : "2", /** Bit flag for {@link #setAllowedNetworkTypes} corresponding to {@link ConnectivityManager#TYPE_BLUETOOTH}. @hide */ NETWORK_BLUETOOTH : "4", /** This download is visible but only shows in the notifications while it's in progress. */ VISIBILITY_VISIBLE : "0", /** This download is visible and shows in the notifications while in progress and after completion. */ VISIBILITY_VISIBLE_NOTIFY_COMPLETED : "1", /** This download doesn't show in the UI or in the notifications. */ VISIBILITY_HIDDEN : "2", /** This download shows in the notifications after completion ONLY. It is usuable only with {@link android.app.DownloadManager#addCompletedDownload(String, String, boolean, String, String, long, boolean)}. */ VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION : "3", /**Set the local destination for the downloaded file. Must be a file URI to a path on external storage, and the calling application must have the WRITE_EXTERNAL_STORAGE permission. <p> The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling {@link #allowScanningByMediaScanner}(). <p> By default, downloads are saved to a generated filename in the shared download cache and may be deleted by the system at any time to reclaim space. <p> For applications targeting {@link android.os.Build.VERSION_CODES#Q} or above, {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE WRITE EXTERNAL_STORAGE} permission is not needed and the {@code uri} must refer to a path within the directories owned by the application (e.g. {@link Context#getExternalFilesDir(String)}) or a path within the top-level Downloads directory (as returned by {@link Environment#getExternalStoragePublicDirectory(String)} with {@link Environment#DIRECTORY_DOWNLOADS}). @param {Object {Uri}} uri a file {@link Uri} indicating the destination for the downloaded file. @return {Object {android.app.DownloadManager.Request}} this object */ setDestinationUri : function( ) {}, /**Set the local destination for the downloaded file to a path within the application's external files directory (as returned by {@link Context#getExternalFilesDir(String)}. <p> The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling {@link #allowScanningByMediaScanner}(). @param {Object {Context}} context the {@link Context} to use in determining the external files directory @param {String} dirType the directory type to pass to {@link Context#getExternalFilesDir(String)} @param {String} subPath the path within the external directory, including the destination filename @return {Object {android.app.DownloadManager.Request}} this object @throws IllegalStateException If the external storage directory cannot be found or created. */ setDestinationInExternalFilesDir : function( ) {}, /**Set the local destination for the downloaded file to a path within the public external storage directory (as returned by {@link Environment#getExternalStoragePublicDirectory(String)}). <p> The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling {@link #allowScanningByMediaScanner}(). <p> For applications targeting {@link android.os.Build.VERSION_CODES#Q} or above, {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE WRITE_EXTERNAL_STORAGE} permission is not needed and the {@code dirType} must be one of the known public directories like {@link Environment#DIRECTORY_DOWNLOADS}, {@link Environment#DIRECTORY_PICTURES}, {@link Environment#DIRECTORY_MOVIES}, etc. @param {String} dirType the directory type to pass to {@link Environment#getExternalStoragePublicDirectory(String)} @param {String} subPath the path within the external directory, including the destination filename @return {Object {android.app.DownloadManager.Request}} this object @throws IllegalStateException If the external storage directory cannot be found or created. */ setDestinationInExternalPublicDir : function( ) {}, /**If the file to be downloaded is to be scanned by MediaScanner, this method should be called before {@link android.app.DownloadManager#enqueue(Request)} is called. @deprecated Starting in Q, this value is ignored. Files downloaded to directories owned by applications (e.g. {@link Context#getExternalFilesDir(String)}) will not be scanned by MediaScanner and the rest will be scanned. */ allowScanningByMediaScanner : function( ) {}, /**Add an HTTP header to be included with the download request. The header will be added to the end of the list. @param {String} header HTTP header name @param {String} value header value @return {Object {android.app.DownloadManager.Request}} this object @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2">HTTP/1.1 Message Headers</a> */ addRequestHeader : function( ) {}, /**Set the title of this download, to be displayed in notifications (if enabled). If no title is given, a default one will be assigned based on the download filename, once the download starts. @return {Object {android.app.DownloadManager.Request}} this object */ setTitle : function( ) {}, /**Set a description of this download, to be displayed in notifications (if enabled) @return {Object {android.app.DownloadManager.Request}} this object */ setDescription : function( ) {}, /**Set the MIME content type of this download. This will override the content type declared in the server's response. @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7">HTTP/1.1 Media Types</a> @return {Object {android.app.DownloadManager.Request}} this object */ setMimeType : function( ) {}, /**Control whether a system notification is posted by the download manager while this download is running. If enabled, the download manager posts notifications about downloads through the system {@link android.app.NotificationManager}. By default, a notification is shown. If set to false, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION. @param {Boolean} show whether the download manager should show a notification for this download. @return {Object {android.app.DownloadManager.Request}} this object @deprecated use {@link #setNotificationVisibility(int)} */ setShowRunningNotification : function( ) {}, /**Control whether a system notification is posted by the download manager while this download is running or when it is completed. If enabled, the download manager posts notifications about downloads through the system {@link android.app.NotificationManager}. By default, a notification is shown only when the download is in progress. <p> It can take the following values: {@link #VISIBILITY_HIDDEN}, {@link #VISIBILITY_VISIBLE}, {@link #VISIBILITY_VISIBLE_NOTIFY_COMPLETED}. <p> If set to {@link #VISIBILITY_HIDDEN}, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION. @param {Number} visibility the visibility setting value @return {Object {android.app.DownloadManager.Request}} this object */ setNotificationVisibility : function( ) {}, /**Restrict the types of networks over which this download may proceed. By default, all network types are allowed. Consider using {@link #setAllowedOverMetered}(boolean) instead, since it's more flexible. <p> As of {@link android.os.Build.VERSION_CODES#N}, setting only the {@link #NETWORK_WIFI} flag here is equivalent to calling {@link #setAllowedOverMetered}(boolean) with {@code false}. @param {Number} flags any combination of the NETWORK_* bit flags. @return {Object {android.app.DownloadManager.Request}} this object */ setAllowedNetworkTypes : function( ) {}, /**Set whether this download may proceed over a roaming connection. By default, roaming is allowed. @param {Boolean} allowed whether to allow a roaming connection to be used @return {Object {android.app.DownloadManager.Request}} this object */ setAllowedOverRoaming : function( ) {}, /**Set whether this download may proceed over a metered network connection. By default, metered networks are allowed. @see ConnectivityManager#isActiveNetworkMetered() */ setAllowedOverMetered : function( ) {}, /**Specify that to run this download, the device needs to be plugged in. This defaults to false. @param {Boolean} requiresCharging Whether or not the device is plugged in. @see android.app.job.JobInfo.Builder#setRequiresCharging(boolean) */ setRequiresCharging : function( ) {}, /**Specify that to run, the download needs the device to be in idle mode. This defaults to false. <p> Idle mode is a loose definition provided by the system, which means that the device is not in use, and has not been in use for some time. @param {Boolean} requiresDeviceIdle Whether or not the device need be within an idle maintenance window. @see android.app.job.JobInfo.Builder#setRequiresDeviceIdle(boolean) */ setRequiresDeviceIdle : function( ) {}, /**Set whether this download should be displayed in the system's Downloads UI. True by default. @param {Boolean} isVisible whether to display this download in the Downloads UI @return {Object {android.app.DownloadManager.Request}} this object @deprecated Starting in Q, this value is ignored. Only files downloaded to public Downloads directory (as returned by {@link Environment#getExternalStoragePublicDirectory(String)} with {@link Environment#DIRECTORY_DOWNLOADS}) will be visible in system's Downloads UI and the rest will not be visible. (e.g. {@link Context#getExternalFilesDir(String)}) will not be visible. */ setVisibleInDownloadsUi : function( ) {}, };