title: How to use Android DownloadManager?
body: <p>I want to download a file to SDCard with Android DownloadManager class:</p>
  
  <pre><code>Request request = new Request(Uri.parse(url));
  request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename); //set destination dir
  long downloadId = downloader.enqueue(request);
  </code></pre>
  
  <p>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.</p>
  
  <p>When i commented out the </p>
  
  <pre><code>request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename); 
  </code></pre>
  
  <p>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: </p>
  
  <pre><code>content://downloads/my_downloads/95
  </code></pre>
  
  <p>I don't know how to copy the file to SDCard.</p>
  
  <p>What I want is download a file to <em>SDCard</em>. Could someone help? Thanks!</p>