Eacces Permission Denied In Kitkat While Writing To Sd Card
Solution 1:
You do not have arbitrary write access to removable storage on Android 4.4+.
You are welcome to:
Use
getExternalFilesDirs()
,getExternalCacheDirs()
, andgetExternalMediaDirs()
methods onContext
. If these return 2+ items, the second and subsequent ones are locations on removable storage, unique to your app, where you can read and write.Use
ACTION_OPEN_DOCUMENT
,ACTION_CREATE_DOCUMENT
, andACTION_OPEN_DOCUMENT_TREE
. These represent the Storage Access Framework and bring up the equivalent of "open file", "save as", and "open directory" dialogs that you might be used to from desktop operating systems. However, what you get back is aUri
representing the selected location, and you would useContentResolver
andDocumentFile
to work with that location.On Android 6.0+, you can use the
StorageVolume
APIs to request access to an entire removable storage volume. However, you will still be working withUri
values, so this is the equivalent of usingACTION_OPEN_DOCUMENT_TREE
, where the user chose the root of a removable storage volume.
Solution 2:
did you add
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
in android manifest file ?
Also it looks like the file /storage/MicroSD/Android/A.mp4. Are you sure the path is correct and that the file A.mp4 exists ?
Post a Comment for "Eacces Permission Denied In Kitkat While Writing To Sd Card"