CreateFile + Exportfile do not work in Android app
Posted: Sun Dec 11, 2022 10:02 pm
Hello!
The file is not saved in the case of an Android application when using the "CreateFile" and "ExportFile" procedures.
In the case of a WEB application, the entry in the Downloads directory was successful.
For the WEB and Android, the source code of the program is the same.
The debug messages are the same(WEB, Android). I couldn 't insert a screenshot of the Debugger window. You can see it here:
https://disk.yandex.ru/i/by_Idn8rsflZCg or https://drive.google.com/file/d/1LSV6Pi ... share_link
In both cases, the "callback" procedure is not called, and its contents do not matter.
Versions SB 2.31 and 2.40 . Android version 10.
The file is not saved in the case of an Android application when using the "CreateFile" and "ExportFile" procedures.
In the case of a WEB application, the entry in the Downloads directory was successful.
For the WEB and Android, the source code of the program is the same.
Code: Select all
; Slightly modified example from SB Help > CreateFile
Global stat.l=-999
Procedure Callback(Status, Filename$, File, SizeRead)
Debug "Status="+Str(status) ; -- [b]NO DISPLAY THIS MESSAGE[/b]
stat=status
Select Status
Case #PB_Status_Saved ; File correctly saved
Case #PB_Status_Error ; File saving has failed
EndSelect
EndProcedure
Procedure Quit()
End
EndProcedure
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Background)
W=WindowWidth(0) : H=WindowHeight(0)
QuitBut=ButtonGadget(#PB_Any, W-100, H-40, 70, 25, "QUIT", #PB_Text_VerticalCenter)
If CreateFile(0, "CreateFile Test.txt", @Callback()) ; we create a new text file
For a=1 To 3 ; 10
If WriteStringN(0, "Line "+Str(a))
Debug Str(a)+": write OK" ; -- [b]DISPLAY THIS MESSAGE[/b]
Else
Debug Str(a) + ": write filed"
EndIf
Next
ExportFile(0, "text/plain")
CloseFile(0)
Else
Debug "CreateFile filed"
EndIf
Debug "stat="+stat ; -- [b]DISPLAY INIT VALUE -999[/b]
BindEvent(#PB_Event_Gadget, @Quit())
https://disk.yandex.ru/i/by_Idn8rsflZCg or https://drive.google.com/file/d/1LSV6Pi ... share_link
In both cases, the "callback" procedure is not called, and its contents do not matter.
Versions SB 2.31 and 2.40 . Android version 10.