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