Sdílet prostřednictvím


DownloadManager.AddCompletedDownload Method

Definition

Overloads

AddCompletedDownload(String, String, Boolean, String, String, Int64, Boolean)

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

AddCompletedDownload(String, String, Boolean, String, String, Int64, Boolean, Uri, Uri)

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

AddCompletedDownload(String, String, Boolean, String, String, Int64, Boolean)

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

[Android.Runtime.Register("addCompletedDownload", "(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;JZ)J", "GetAddCompletedDownload_Ljava_lang_String_Ljava_lang_String_ZLjava_lang_String_Ljava_lang_String_JZHandler")]
public virtual long AddCompletedDownload (string? title, string? description, bool isMediaScannerScannable, string? mimeType, string? path, long length, bool showNotification);
[<Android.Runtime.Register("addCompletedDownload", "(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;JZ)J", "GetAddCompletedDownload_Ljava_lang_String_Ljava_lang_String_ZLjava_lang_String_Ljava_lang_String_JZHandler")>]
abstract member AddCompletedDownload : string * string * bool * string * string * int64 * bool -> int64
override this.AddCompletedDownload : string * string * bool * string * string * int64 * bool -> int64

Parameters

title
String

the title that would appear for this file in Downloads App.

description
String

the description that would appear for this file in Downloads App.

isMediaScannerScannable
Boolean

true if the file is to be scanned by MediaScanner. Files scanned by MediaScanner appear in the applications used to view media (for example, Gallery app).

mimeType
String

mimetype of the file.

path
String

absolute pathname to the file. The file should be world-readable, so that it can be managed by the Downloads App and any other app that is used to read it (for example, Gallery app to display the file, if the file contents represent a video/image).

length
Int64

length of the downloaded file

showNotification
Boolean

true if a notification is to be sent, false otherwise

Returns

an ID for the download entry added to the downloads app, unique across the system This ID is used to make future calls related to this download.

Attributes

Remarks

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

It is helpful to make the file scannable by MediaScanner by setting the param isMediaScannerScannable to true. It makes the file visible in media managing applications such as Gallery App, which could be a useful purpose of using this API.

For applications targeting android.os.Build.VERSION_CODES#Q or above, path must be within directories owned by the application {e.g. Context#getExternalFilesDir(String)} or if the application is running under the legacy storage model (see android.R.styleable#AndroidManifestApplication_requestLegacyExternalStorage android:requestLegacyExternalStorage), path can also be within the top-level Downloads directory (as returned by Environment#getExternalStoragePublicDirectory(String) with Environment#DIRECTORY_DOWNLOADS).

This member is deprecated. Apps should instead contribute files to android.provider.MediaStore.Downloads collection to make them available to user as part of Downloads.

Java documentation for android.app.DownloadManager.addCompletedDownload(java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

AddCompletedDownload(String, String, Boolean, String, String, Int64, Boolean, Uri, Uri)

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

[Android.Runtime.Register("addCompletedDownload", "(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;JZLandroid/net/Uri;Landroid/net/Uri;)J", "GetAddCompletedDownload_Ljava_lang_String_Ljava_lang_String_ZLjava_lang_String_Ljava_lang_String_JZLandroid_net_Uri_Landroid_net_Uri_Handler", ApiSince=24)]
public virtual long AddCompletedDownload (string? title, string? description, bool isMediaScannerScannable, string? mimeType, string? path, long length, bool showNotification, Android.Net.Uri? uri, Android.Net.Uri? referer);
[<Android.Runtime.Register("addCompletedDownload", "(Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;JZLandroid/net/Uri;Landroid/net/Uri;)J", "GetAddCompletedDownload_Ljava_lang_String_Ljava_lang_String_ZLjava_lang_String_Ljava_lang_String_JZLandroid_net_Uri_Landroid_net_Uri_Handler", ApiSince=24)>]
abstract member AddCompletedDownload : string * string * bool * string * string * int64 * bool * Android.Net.Uri * Android.Net.Uri -> int64
override this.AddCompletedDownload : string * string * bool * string * string * int64 * bool * Android.Net.Uri * Android.Net.Uri -> int64

Parameters

title
String

the title that would appear for this file in Downloads App.

description
String

the description that would appear for this file in Downloads App.

isMediaScannerScannable
Boolean

true if the file is to be scanned by MediaScanner. Files scanned by MediaScanner appear in the applications used to view media (for example, Gallery app).

mimeType
String

mimetype of the file.

path
String

absolute pathname to the file. The file should be world-readable, so that it can be managed by the Downloads App and any other app that is used to read it (for example, Gallery app to display the file, if the file contents represent a video/image).

length
Int64

length of the downloaded file

showNotification
Boolean

true if a notification is to be sent, false otherwise

uri
Uri

the original HTTP URI of the download

referer
Uri

the HTTP Referer for the download

Returns

an ID for the download entry added to the downloads app, unique across the system This ID is used to make future calls related to this download.

Attributes

Remarks

Adds a file to the downloads database system, so it could appear in Downloads App (and thus become eligible for management by the Downloads App).

It is helpful to make the file scannable by MediaScanner by setting the param isMediaScannerScannable to true. It makes the file visible in media managing applications such as Gallery App, which could be a useful purpose of using this API.

For applications targeting android.os.Build.VERSION_CODES#Q or above, path must be within directories owned by the application {e.g. Context#getExternalFilesDir(String)} or if the application is running under the legacy storage model (see android.R.styleable#AndroidManifestApplication_requestLegacyExternalStorage android:requestLegacyExternalStorage), path can also be within the top-level Downloads directory (as returned by Environment#getExternalStoragePublicDirectory(String) with Environment#DIRECTORY_DOWNLOADS).

This member is deprecated. Apps should instead contribute files to android.provider.MediaStore.Downloads collection to make them available to user as part of Downloads.

Java documentation for android.app.DownloadManager.addCompletedDownload(java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean, android.net.Uri, android.net.Uri).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to