I used Erel's code supplied in https://www.b4x.com/android/forum/threads/how-to-ext-sd-card-write-on-android-4-4.42177/#post-255351
But I find that it's the SECOND path which refers to the external drive. My log says:
Therefore I think that File.DirDefaultExternal should return the second location, not the first!!
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim paths() As Object = GetContext.RunMethod("getExternalFilesDirs", Array(Null))
For Each p As Object In paths
Log(p)
Next
End Sub
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
The first path will be the same as File.DirDefaultExternal.
But I find that it's the SECOND path which refers to the external drive. My log says:
B4X:
/storage/emulated/0/Android/data/uk.co.pennypress.FileLocations/files
/storage/external_SD/Android/data/uk.co.pennypress.FileLocations/files
Therefore I think that File.DirDefaultExternal should return the second location, not the first!!
Last edited: