Reputation: 683
I tried to use android download manager to download file.
request.setDestinationInExternalPublicDir("/myfile", "abc.txt");
enqueue = dm.enqueue(request);
So the file will be downloaded to /storage/sdcard/myfile/abc.txt
.
However, for external removal sd card, the path is /storage/sdcard1/
.
request.setDestinationInExternalPublicDir
defaults is /storage/sdcard/
.
How can I set the download path to /storage/sdcard1/myfile/abc.txt
?
Upvotes: 2
Views: 2023
Reputation: 12304
Use setDestination
instead. THis is an example. Change this Environment.getExternalStorageDirectory()
to your hardcoded path.
File root = new File(Environment.getExternalStorageDirectory() + File.separator);
Uri path = Uri.withAppendedPath(Uri.fromFile(root), "this_is_downloaded_file.png");
request.setDestinationUri(path);
Upvotes: 3