title: Android 11 (R) file path access
body: <p>According to the docs file path access is granted in Android R:</p>
  
  <blockquote>
    <p>Starting in Android 11, apps that have the READ_EXTERNAL_STORAGE permission can read a device's media files using direct file paths and native libraries. This new capability allows your app to work more smoothly with third-party media libraries.</p>
  </blockquote>
  
  <p>The problem is that I can't get the file path from <code>MediaStore</code>, so how are we supposed to read a file path that we can't access/retrieve? Is there a way, I'm not aware of, that we can get the file path from <code>MediaStore</code>?</p>
  
  <hr>
  
  <p>Furthermore, <a href="https://developer.android.com/preview/privacy/storage#all-files-access" rel="noreferrer">the docs say the following</a>:</p>
  
  <blockquote>
    <p><strong>All Files Access</strong></p>
    
    <p>Some apps have a core use case that requires broad file access, such as file management or backup &amp; restore operations. They can get All Files Access by doing the following:</p>
    
    <ol>
    <li>Declare the MANAGE_EXTERNAL_STORAGE permission.</li>
    <li>Direct users to a system settings page where they can enable the Allow access to manage all files option for your app.</li>
    </ol>
    
    <p>This permission grants the following:</p>
    
    <ul>
    <li>Read access and write access to all files within shared storage.</li>
    <li>Access to the contents of the MediaStore.Files table.</li>
    </ul>
  </blockquote>
  
  <p>But I do not need all file access, I only want the user to select a video from <code>MediaStore</code> and pass the file path to <code>FFmpeg</code>(it requires a file path). I know that I can no longer use the <code>_data</code> column to retrieve a file path.</p>
  
  <hr>
  
  <p>Please note:</p>
  
  <ul>
  <li>I know a <code>Uri</code> is returned from <code>MediaStore</code> and does not point to a file.</li>
  <li>I know that I can copy the file to my application directory and pass that to <code>FFmpeg</code>, but I could do that before Android R.</li>
  <li>I can not pass <code>FileDescriptor</code> to <code>FFmpeg</code> and I can not use <code>/proc/self/fd/</code> (I get <code>/proc/7828/fd/70: Permission denied</code> when selecting a file from the SD Card), have a look at <a href="https://github.com/tanersener/mobile-ffmpeg/issues/334" rel="noreferrer">this issue</a>.</li>
  </ul>
  
  <hr>
  
  <p>So what am I supposed to do, am I missing something? What was meant with <code>can read a device's media files using direct file paths and native libraries</code>?</p>