Android Question How to solve Permission denied in Android 4.4 Kitkat

Rick Harris

Well-Known Member
Licensed User
Google apparently has (to the anger of many people) blocked the ability to read and write to the external SD card from Android 4.4 upwards. The strange thing is that a "permission denied" error also occurs when using the Random Access File (RAF) library simply when reading a file! How can this be resolved?

I have added the following lines to the manifest:


but it has no effect.

Furthermore, the File.DirRootExternal command does not work with my brand new Samsung Galaxy Tab S 8.4. It should report: /storage/extSdCard/ but doesn't!

Any suggestions would be welcome. I don't want to root my device, which seems to be the only way to get access to the externa SD card. I thought Google's slogan was: "Don't do evil"....

Rick Harris

Well-Known Member
Licensed User
I wouldn't call internal memory an "SD card", but what's in a name. It is really horrible what Google has done.
In the mean time I have solved the RAF file problem. The "permission denied" error does not occur if the RAF is initialized with the read-only parameter set to TRUE.

If you know how to access the external SD card with something similar to File.DirRootExternal (which does not work) then please let me know. At present I have to specify the true Samsung external SD directory name:



Licensed User
There's no standard regarding the external storage so "/storage/extSdCard/" will only work on that Samsung (or devices that by chance use the same path).
Last edited:

Rick Harris

Well-Known Member
Licensed User
It seems it is now necessary to detect whether the device has Android 4.4 or higher because
GetContext.RunMethod("getExternalFilesDirs", Array(Null)) generates an error on older devices.
I now use something like this:
Dim Phone1 as Phone
If Phone1.SdkVersion >=19 Then
   Dim paths() As Object = GetContext.RunMethod("getExternalFilesDirs", Array(Null))
   For Each p As Object In paths
      'Analyse and use one of these paths
    'Use File.DirRootExternal
 End If
If there is a better way, then please let me know!