Język

DownloadManager.Request.SetDestinationInExternalPublicDir Method

Definition

Set the local destination for the downloaded file to a path within the public external storage directory (as returned by GetExternalStoragePublicDirectory(String)).

[Android.Runtime.Register("setDestinationInExternalPublicDir", "(Ljava/lang/String;Ljava/lang/String;)Landroid/app/DownloadManager$Request;", "GetSetDestinationInExternalPublicDir_Ljava_lang_String_Ljava_lang_String_Handler")]
public virtual Android.App.DownloadManager.Request? SetDestinationInExternalPublicDir(string? dirType, string? subPath);
[<Android.Runtime.Register("setDestinationInExternalPublicDir", "(Ljava/lang/String;Ljava/lang/String;)Landroid/app/DownloadManager$Request;", "GetSetDestinationInExternalPublicDir_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member SetDestinationInExternalPublicDir : string * string -> Android.App.DownloadManager.Request
override this.SetDestinationInExternalPublicDir : string * string -> Android.App.DownloadManager.Request

Parameters

dirType
String

String: the directory type to pass to GetExternalStoragePublicDirectory(String)

subPath
String

String: the path within the external directory, including the destination filename

Returns

this object

Attributes

Exceptions

If the external storage directory cannot be found or created.

Remarks

Set the local destination for the downloaded file to a path within the public external storage directory (as returned by GetExternalStoragePublicDirectory(String)). Through Android 9, AllowScanningByMediaScanner() requests media scanning. Starting in Android 10, that method is ignored; the system determines whether to scan the file from its destination. On Android 10 and later, if the application targets Android 10 or later, WRITE_EXTERNAL_STORAGE permission is not needed and dirType must name a known public directory, such as DirectoryDownloads, DirectoryPictures, or DirectoryMovies.

Android reference for android.app.DownloadManager.Request.setDestinationInExternalPublicDir.

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