I want to download a file to SDCard with Android DownloadManager class:
Request request = new Request(Uri.parse(url));
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename); //set destination dir
long downloadId = downloader.enqueue(request);
But I always get download status=16(STATUS_FAILED), and reason=1008(ERROR_CANNOT_RESUME). I have already included android.permission.WRITE_EXTERNAL_STORAGE in the manifest.
When i commented out the
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
and use the default download folder, it's OK. But I don't know where is the file goes, the localUri I get from the result is something like:
content://downloads/my_downloads/95
I don't know how to copy the file to SDCard.
What I want is download a file to SDCard. Could someone help? Thanks!