Language

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 Environment.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 Environment.getExternalStoragePublicDirectory(String)

subPath
String

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

Returns

this object

Attributes

Remarks

Set the local destination for the downloaded file to a path within the public external storage directory (as returned by Environment.getExternalStoragePublicDirectory(String)). The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling allowScanningByMediaScanner(). For applications targeting Build.VERSION_CODES.Q or above, WRITE_EXTERNAL_STORAGE permission is not needed and the dirType must be one of the known public directories like Environment.DIRECTORY_DOWNLOADS, Environment.DIRECTORY_PICTURES, Environment.DIRECTORY_MOVIES, etc.

Throws: IllegalStateException If the external storage directory cannot be found or created.

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