For an existent file in the internal storage of the phone, path of which is /system/data/recf/pic.jpg, constructing inputStream using openInputStream() method throws FileNotFoundException.
This is what I am doing-
ContentResolver cr = context.getContentResolver();
InputStream inputStream = null;
Uri filename = Uri.parse("file:///system/data/recf/pic.jpg");
inputStream = cr.openInputStream(filename);
But it is throwing a FileNotFoundException. I have checked that the file exists. Stuck for a long time, please help. Thanks.
Device's Internal Storage (Phone Storage) is still considered External Storage in terms of Android. "External Storage" may refer to removable storage such as SD card or non-removable internal storage of phone.
"Internal Storage" refers to a private space of your app which is not shared with anyone, including the user.
Hence, permission to read from and write to External Storage was required. On Android M+, real-time permission was required.