I'm getting a permission denied error when attempting to write to an external Micro SD card that has been put inside the tablet. I've failed trying to save a file to the Micro SD using hard coded values for the path and when also using what is returned from getExternalStorageDirectory().
Here are the things that I've noted while testing this out.
- The path to my Micro SD card is /storage/sdcard1/ (myself and utility verified)
- /storage/emulated/0 is returned from Environment.getExternalStorageDirectory()
- The path /storage/sdcard1/ is valid as I can read from it
- Permissions set (android.permission.WRITE_EXTERNAL_STORAGE) is in Manifest.xml
- The permission tag is in the correct location of Manifest.xml (outside of application tag)
- I can write to /storage/scard0/ hard-coded and by getExternalStorageDirectory()
The other threads say to not hard-code when writing to the SD card and use what is returned from getExternalStorageDirectory(), but that doesn't return my external micro sd card.
I get this when I try to write to it.
Java.io.FileNotFound: /storage/scard1/Report Summary.csv : open failed: EACCESS (permission denied)
In this situation what can I do to write to the micro sd card?
Aucun commentaire:
Enregistrer un commentaire