title: What permissions do I need to download files?
body: <p>I am trying to download a file using the <code>DownloadManager</code> class.</p>
  
  <pre><code>public void downloadFile(View view) {
  
      String urlString = "your_url_here";
      try {
          // Get file name from the url
          String fileName = urlString.substring(urlString.lastIndexOf("/") + 1);
          // Create Download Request object
          DownloadManager.Request request = new DownloadManager.Request(Uri.parse((urlString)));
          // Display download progress and status message in notification bar
          request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
          // Set description to display in notification
          request.setDescription("Download " + fileName + " from " + urlString);
          // Set title
          request.setTitle("DownloadManager");
          // Set destination location for the downloaded file
          request.setDestinationUri(Uri.parse("file://" + Environment.getExternalStorageDirectory() + "/" + fileName));
          // Download the file if the Download manager is ready
          did = dManager.enqueue(request);
  
      } catch (Exception e) {
      }
  }
  
  // BroadcastReceiver to receive intent broadcast by DownloadManager
  private BroadcastReceiver downloadReceiver = new BroadcastReceiver() {
  
      @Override
      public void onReceive(Context arg0, Intent arg1) {
          // TODO Auto-generated method stub
          Query q = new Query();
          q.setFilterById(did);
          Cursor cursor = dManager.query(q);
          if (cursor.moveToFirst()) {
              String message = "";
              int status = cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS));
              if (status == DownloadManager.STATUS_SUCCESSFUL) {
                  message = "Download successful";
              } else if (status == DownloadManager.STATUS_FAILED) {
                  message = "Download failed";
              }
              tvMessage.setText(message);
          }
  
  
      }
  };
  </code></pre>
  
  <p>I am using <code>dexter</code> to obtain permissions</p>
  
  <pre><code> Dexter.withActivity(this)
                  .withPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
                  .withListener(new PermissionListener() {
                      @Override
                      public void onPermissionGranted(PermissionGrantedResponse response) {
  </code></pre>
  
  <p>I also have both in my manifest</p>
  
  <pre><code>    &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>But I still get this error while trying to download files (ONLY on Oreo). It works on android 7</p>
  
  <pre><code>No permission to write to /storage/emulated/0/download: Neither user 10205 nor current process has android.permission.WRITE_EXTERNAL_STORAGE.
  </code></pre>