Docs say:
In order to read or write files on the external storage, your app must acquire the READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE system permissions.
I do not use READ_EXTERNAL_STORAGE
or WRITE_EXTERNAL_STORAGE
permissions in manifest of my App. But it is strange, because this code runs successfully:
File file = new File("/storage/sdcard0/ImageStore/Mat1.jpg");
FileInputStream fis = null;
byte[] buffer = null;
try {
fis = new FileInputStream(file);
buffer = new byte[1024];
fis.read(buffer );
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Why this code runs without exception while reading and writing permissions are denied?
Note:
If External Storage is not mounted,bad mounted or ..., then obviously FileNotFoundException
occurs
developer.android.com states this regarding the READ_EXTERNAL_STORAGE permission
This permission is enforced starting in API level 19. Before API level 19, this permission is not enforced and all apps still have access to read from external storage.