Hi,
I'm trying to write on removable storage , But getting IOException
java.io.FileNotFoundException:
/storage/extSdCard/PWC/Images/IMG_20151210_113150.jpg: open failed: EACCES
(Permission denied)
at libcore.io.IoBridge.open(IoBridge.java:409)
Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission
denied)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:393)
The line I used to write is
try{
FileInputStream myinput = new FileInputStream(from);
String outfilename = to;
OutputStream myoutput = new FileOutputStream(outfilename);
// transfer byte to inputfile to outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = myinput.read(buffer)) > 0) {
myoutput.write(buffer, 0, length);
}
//Close the streams
myoutput.flush();
myoutput.close();
myinput.close();
return true;
}
catch ( IOException e){
e.printStackTrace();
return false;
}
from and to is a valid file location.
If I use Internal and Emulated External file path , Above is working fine.
If I use secondary or removable storage file path , getting issue.
The path gives canWrite as true.
Testing on Android 4.4.2 Samsung SM-G350E
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/43d0467c-9c45-407c-a990-7941bfbd89a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.