Android Question Android 4.4.2 and sdcard

andrewmp

Member
Licensed User
Longtime User
We are trying to write to external sd card , prog. ver 3.82
Tablet Samsung SM1211 (Samsung Galaxy Tab3)

File.DirRootExternal returns /storage/emulated/0/
File.DirDefaultExternal returns /storage/emulated/0/Android/data/[app name]/files

In both cases it's physically a folder in the tablet and not on the sd card.

Do we have to enable sonthing to write to sd card?

thanks in advance
 

andrewmp

Member
Licensed User
Longtime User
Ok .

Added to the manifest:

AddPermission(android.permission.WRITE_MEDIA_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)

Added:

Sub GetContext As JavaObject
Return GetBA.GetField("context")
End Sub

Sub GetBA As JavaObject
Dim jo As JavaObject
Dim cls As String = Me
cls = cls.SubString("class ".Length)
jo.InitializeStatic(cls)
Return jo.GetFieldJO("processBA")
End Sub

and

Dim paths() As Object = GetContext.RunMethod("getExternalFilesDirs", Array(Null))
For Each p As Object In paths
Log(p)
Next

Like the post said the first path=File.DirDefaultExternal , which does not help because it's not pointing to the sdcard

The second path looked promising = /storage/extSdCard/Android/data/[app name]/files, tried to create a folder there and it worked

Thanks for the help
 
Upvote 0
Top