I've reposted my question below with corrected tags. I'm not sure what you mean when you say "You need to post the log." No messages appear in the log section of the B4A IDE when this small app is compiled.
I am now trying to use the
RuntimePermissions.GetSafeDirDefaultExternal function instead of
File.DirDefaultExternal to read and write files to a safe external directory. Unfortunately this function is causing a fatal error when used in apps on my phone (running Android 10). The following tiny sample app crashes on my phone when the
GetSafeDirDefaultExternal function is encountered . I see that there are some related posts on the forum but they don't show solutions that solve this problem. I've updated the
tools directory and the other resources in the
/Android folder as one post recommends but this function is still causing a fatal error. There must be a simple explanation for this problem because users are obviously using this function successfully.
Sub Process_Globals
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
Public xui As XUI
Dim rp As RuntimePermissions
xui.MsgboxAsync("test 1", "debug")
Wait for Msgbox_Result(Result As Int)
'This statement executes properly
xui.MsgboxAsync("File.DirDefaultExternal: " & File.DirDefaultExternal, "debug")
Wait for Msgbox_Result(Result As Int)
'This statement causes the app to crash!
xui.MsgboxAsync("rp.GetSafeDirDefaultExternal(): " & rp.GetSafeDirDefaultExternal(""), "debug")
Wait for Msgbox_Result(Result As Int)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub