android download manager download to external removable sd card -
i tried use android download manager download file.
request.setdestinationinexternalpublicdir("/myfile", "abc.txt"); enqueue = dm.enqueue(request);
so file downloaded /storage/sdcard/myfile/abc.txt
.
however, external removal sd card, path /storage/sdcard1/
.
request.setdestinationinexternalpublicdir
defaults /storage/sdcard/
.
how can set download path /storage/sdcard1/myfile/abc.txt
?
use setdestination
instead. example. change environment.getexternalstoragedirectory()
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);
Comments
Post a Comment