title: DownloadManager with cookie authentication
body: <p>I'm trying to get a zip file using DownloadManager parsing a cookie with a JSESSIONID from my server. I'm getting this JSESSIONID doing all my process login using HTTPCLIENT lib and setting a variable JSESSIONID for later use in my DownloadManager request.</p>
  
  <p>My download request:</p>
  
  <pre><code>    DownloadManager.Request request = new DownloadManager.Request(Uri.parse(htmlUrlDownload));
  
      request.addRequestHeader("Cookie", "JSESSIONID=" + JSESSIONID);
      request.addRequestHeader(Constants.USER_AGENT, Constants.TARGET_REQUEST_HEADER);
  
      request.setDescription("Baixando " + metaDado.getType());
      request.setTitle("Download");
      request.allowScanningByMediaScanner();
      request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
  
      String nameFile = offlineUuid + ".zip";
  
      fileName = nameFile;
  
      filePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DOWNLOADS
              + File.separator + fileName;
  
      request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, nameFile);
  
      final DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
  
      final long downloadId = manager.enqueue(request);
  </code></pre>
  
  <p>The problem is that download never starts and the COLUMN_REASON returns a code to <a href="http://developer.android.com/reference/android/app/DownloadManager.html" rel="nofollow">ERROR_UNHANDLED_HTTP_CODE</a></p>
  
  <p>But if I try to download the same file using a dropbox link without authentication or using httpclient,  it's works perfectly, what am I doing wrong?</p>
  
  <p>How can I get a better msg error?</p>