title: Android 11 - Accessing Files in my app Android/Data folder
body: <p>I'm really struggling with this for some reason and am hoping someone can help point me in the right direction.</p>
  <p>I am targeting Android 11 / API 30 which is where the trouble seems to all stem from.  Targeting lower might work for me - but it seems like Google is going to force me down this path eventually so I might as well just figure this out.</p>
  <p>My apps typically write files out to the standard</p>
  <pre><code>getExternalFilesDir(null)
  </code></pre>
  <p>This gives me a path on the device which is</p>
  <pre><code>/storage/emulated/0/Android/data/com.domain.testapp/files
  </code></pre>
  <p>I also tried other types, like:</p>
  <pre><code>getExternalFilesDir(Environment.DIRECTORY_PICTURES)
  </code></pre>
  <p>results in</p>
  <pre><code>/storage/emulated/0/Android/data/com.domain.testapp/files/Documents
  </code></pre>
  <p>My app has no trouble actually writing files out to this location.  In Android 11 I have to jump through some hoops with the local file explorer to see these files - but they do exist on the device.</p>
  <p>I am now trying to give the user some ability to see the files and share the files and that's where I'm stumped!</p>
  <p>This code below results in no files found</p>
  <pre><code>File filePath = this.getExternalFilesDir(null);
  String filePathString = filePath.toString();
  
  ArrayList&lt;String&gt; myData = new ArrayList&lt;&gt;();
  File fileDir = new File(filePathString);
  
  String[] files = fileDir.list();
  
  if(files.length == 0){
      Log.w(APPID, &quot;NO FILES IN FOLDER&quot;);
  }
  </code></pre>
  <p>Yes - I know the File and .toString() is not needed - but I was logging them out each step because I thought I was crazy.</p>
  <p>I know for a FACT that there are a dozen or so files in the folder this is pointing to in this app.  This app created the files.  Shouldn't it be able to see the files in the folder???</p>
  <p>Manifest has the following permissions - which I dont think it needs all of:</p>
  <pre><code>&lt;uses-permission android:name = &quot;android.permission.MANAGE_EXTERNAL_STORAGE&quot;/&gt;
  &lt;uses-permission android:name = &quot;android.permission.WRITE_EXTERNAL_STORAGE&quot;/&gt;
  </code></pre>
  <p>No permissions show as denied to the app</p>
  <p>I thought about using the external storage - but it seems like this is even harder in Android 11?  Or is that really an easier path to take?</p>
  <p>I did try playing with this, but it seems deprecated and soon to be gone?</p>
  <pre><code>File downloadFilePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
  </code></pre>
  <p>which is this folder on my device</p>
  <pre><code>/storage/emulated/0/Download
  </code></pre>
  <p>And I can definitely see the files in there with any file explorer.</p>
  <p>Any thoughts on how to get access to the files this app created?</p>
  <p>I'm probably missing something really obvious.</p>
  <p>Any suggestions welcomed!!</p>