0

I can use the android downloader to download files. and the code is Here

By default android stores the files in download directory. How can I specify the path where it should be downloaded? If this is not possible, I plan to copy the file in sd card and I want to delete the src file(the file in the download folder. But I am unable to delete the file from the download folder. How can I achieve it?

Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
Meher
  • 2,545
  • 3
  • 26
  • 53

2 Answers2

1

setDestinationInExternalPublicDir

DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
    Request request = new Request(
            Uri.parse("url for file to download"));
    request.setDestinationInExternalPublicDir (String dirType, String subPath);
    long enqueue = dm.enqueue(request);

this method may help you!

tigger
  • 83
  • 5
  • dirType:the directory type to pass to getExternalFilesDir(String), subPath:the path within the external directory, including the destination filename – tigger Jul 25 '12 at 01:20
0
                    Environment.getExternalStorageDirectory().getPath() + "/download";

could you change the "/download" part? I think that would save it onto external storage though

xump
  • 1
  • 1