Running my App on a Huawei Mate 20, the following lines:
String ext_path = Environment.getExternalStorageDirectory().getAbsolutePath();
File ext_folder = new File(ext_path);
System.out.println("Path: " + ext_path + " Dir Check: " + ext_folder.isDirectory() + " Can read: " + ext_folder.canRead());
Return: "Path: /storage/emulated/0 Dir Check: true Can read: false"
However, I have given all permissions and I have also included these in the manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Shouldn't canRead() return True? I cannot write or read files. What could be the reason?
I also tried:
String extStore = System.getenv("EXTERNAL_STORAGE");
File f_exts = new File(extStore);
System.out.println(f_exts);
System.out.println(Arrays.toString(f_exts.listFiles()));
and I get: "EXTERNAL_STORAGE" and "null"