Language

DownloadManager.Request.SetDestinationUri(Uri) Method

Definition

Set the local destination for the downloaded file.

[Android.Runtime.Register("setDestinationUri", "(Landroid/net/Uri;)Landroid/app/DownloadManager$Request;", "GetSetDestinationUri_Landroid_net_Uri_Handler")]
public virtual Android.App.DownloadManager.Request? SetDestinationUri(Android.Net.Uri? uri);
[<Android.Runtime.Register("setDestinationUri", "(Landroid/net/Uri;)Landroid/app/DownloadManager$Request;", "GetSetDestinationUri_Landroid_net_Uri_Handler")>]
abstract member SetDestinationUri : Android.Net.Uri -> Android.App.DownloadManager.Request
override this.SetDestinationUri : Android.Net.Uri -> Android.App.DownloadManager.Request

Parameters

uri
Uri

Uri: a file Uri indicating the destination for the downloaded file.

Returns

this object

Attributes

Remarks

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. The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling allowScanningByMediaScanner(). 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. For applications targeting Build.VERSION_CODES.Q or above, WRITE EXTERNAL_STORAGE permission is not needed and the uri must refer to a path within the directories owned by the application (e.g. Context.getExternalFilesDir(String)) or a path within the top-level Downloads directory (as returned by Environment.getExternalStoragePublicDirectory(String) with Environment.DIRECTORY_DOWNLOADS). All non-visible downloads that are not modified in the last 7 days will be deleted during idle runs.

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

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