问题
I recieve a intent from camera with a photo taken in this path:
/storage/extSdCard/DCIM/Camera/photoCaptured.jpg
And I want to resize (already does) of the image and overwrite in the same path...
I can do it on 2.3, 4.1 and 4.3, but... not in 4.4
so... maybe the problem is the permission on this folder, so I check with this...
if( myFile.canWrite() ){
Log.e("myMethodToSave", "you have permission: " + myFile);
} else {
Log.e("myMethodToSave", "forget it!: " + myFile);
}
...and I have permission to write but 4.4, says Permission Denied
Why?
How can I resolve this?
EDITED
salida = new FileOutputStream(myFile); //error only on kit kat
bitmap.compress(Bitmap.CompressFormat.JPEG, 70, salida);
回答1:
The reason from http://source.android.com/devices/tech/storage/index.html
The WRITE_EXTERNAL_STORAGE permission must only grant write access to the primary external storage on a device. Apps must not be allowed to write to secondary external storage devices, except in their package-specific directories as allowed by synthesized permissions. Restricting writes in this way ensures the system can clean up files when applications are uninstalled.
来源:https://stackoverflow.com/questions/25469893/file-canwrite-says-true-but-i-cant-write-on-removable-storage-kit-kat