0

I have an app running on Android 11 where I am trying to list the contents of the Download directory.

At first try I was getting just the folder names. Then I added

requestPermissions( EXTERNAL_PERMS, EXTERNAL_REQUEST);

Now I am getting .mp3, and .jpg files listed but not other like .pdf

Any idea how to fix this?

I have been reading and trying all the permission requests.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

And the code for gettting the files:

requestPermissions(EXTERNAL_PERMS, EXTERNAL_REQUEST);
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File files[] = path.listFiles();

Thank you

DCuser
  • 953
  • 2
  • 10
  • 21

1 Answers1

0

I have implemented the answer from this post and now I can get access to all files.

Android 11 Scoped storage permissions

I understand that the answer provided here is most likely not accepted in the PlayStore but for me that is ok.

DCuser
  • 953
  • 2
  • 10
  • 21