title: Primary directory Audio not allowed for content://media/external/file; allowed directories are [Download, Documents] - IllegalArgumentException
body: <p>I Need a download a audio files from server its working still 29 , and i changed the code for 30 above am facing this issue. I checked here but not found the answer.</p>
  <p>Here is my code snippets</p>
  <pre><code>               File destination = new File(getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) + File.separator,  urltoDownload.getName());
  final String  relativeLocation = getApplicationContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) + File.separator + urltoDownload.getName();
  
              ContentValues values = new ContentValues();
              values.put(MediaStore.Audio.Media.TITLE, urltoDownload.getName());
              values.put(MediaStore.Audio.Media.DISPLAY_NAME, urltoDownload.getName());
              values.put(MediaStore.Audio.Media.MIME_TYPE, &quot;audio/mp3&quot;);
              values.put(MediaStore.Audio.Media.DATE_ADDED, System.currentTimeMillis() / 1000);
              values.put(MediaStore.Audio.Media.DATE_TAKEN, System.currentTimeMillis());
              values.put(MediaStore.Audio.Media.RELATIVE_PATH, &quot;Audio/&quot; + relativeLocation); 
              Uri uri = getApplicationContext().getContentResolver().insert(MediaStore.Files.getContentUri(&quot;external&quot;), values);
  
   ParcelFileDescriptor descriptor = getApplicationContext().getContentResolver().openFileDescriptor(uri,&quot;w&quot;); //&quot;w&quot; specify's write mode
              FileDescriptor fileDescriptor = descriptor.getFileDescriptor();
  
              InputStream dataInputStream = getApplicationContext().openFileInput(destination.getPath());
              OutputStream output = new FileOutputStream(fileDescriptor);
              byte[] buf = new byte[1024];
              int bytesRead;
              while ((bytesRead = dataInputStream.read(buf)) &gt; 0)
              {
                  output.write(buf, 0, bytesRead);
              }
              dataInputStream.close();
              output.close();
  </code></pre>