In below android 11 we can get the all files from public directory(Downloads) using File(getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)).listFiles() but in android 11 when i try to access files am getting files which are related to my application am unable to get all the files and how can we get all the files in android 11
am using this both permissions for reading and writing file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
this is snippet for getting list
val files: Queue<File> = LinkedList()
val ROOT_DIR = getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).absolutePath
files.addAll(File(ROOT_DIR).listFiles())