title: RecoverableSecurityException no access to content://media/external/audio/media
body: <p>I have a music player app, and it used to work when I tried to delete a file. However, since API 29, I'm getting the following error when I tried to delete the file via the contentResolver.delete.</p>
  <p>android.app.RecoverableSecurityException: musicplayer has no access to content://media/external/audio/media/1324</p>
  <pre><code> AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
  alert.setMessage(&quot;Are you sure you want to delete &quot; + mSongList.get(selectedPosition).getSongName());
  alert.setPositiveButton(&quot;YES&quot;, new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
              ContentResolver contentResolver = getActivity().getContentResolver();
                                      contentResolver.delete(mSongList.get(selectedPosition).getSongUri(), null, null);
          mSongList.remove(selectedPosition);
          mAdapterListFile.notifyDataSetChanged();
          serviceMusic.setSongList(mSongList);
              dialog.dismiss();
          }
      });
      alert.setNegativeButton(&quot;NO&quot;, new OnClickListener() {
              @Override
              public void onClick(DialogInterface dialog, int which) {
                      dialog.dismiss();
                      }
                  });
  
      alert.show();
  </code></pre>