My B4A application worked perfectly until I added an interstitiate AD before I open a file in Dirinternal.
Each time the Ad is displayed, the file disappears in DirInternal (!).
If I comment the "IAd.show" command, the file is kept (!)
Any idea what could be the reason ?
B4X:
'Download file from Dropbox when "Activity_create.FirstTime=True"
dbx.Download("/catalog.db",File.DirInternal,"catalog.db")
(...)
'Display Interstitiate when ready
If IAd.Ready Then
IAd.Show
End If
If File.Exists(File.DirInternal,"catalog.db")=False Then
Log("Bug : The file disappeared !")
end if
'As a result, this instruction crashes with IAd.show due to file removed
sql2.Initialize(File.DirInternal,"catalog.db",False)
I found that the intial delete+download of my DB file did not complete on time.
I have added 2 infinite loops to ensure file delete and file download are complete before going forward and it solved the issue.
I still don't understand why the bug appeared with an interstitial Ad but my code was definitively wrong.
Thanks for your help !
B4X:
If File.Exists(File.Dirinternal,"catalog.db") Then
File.Delete(File.Dirinternal,"catalog.db")
Do While File.Exists(File.DirInternal,"catalog.db")=True
Sleep(0)
Loop
End If
dbx.Download("/catalog.db",File.DirInternal,"catalog.db")
'On attend le fichier
Do While File.Exists(File.DirInternal,"catalog.db")=False
Sleep(0)
Loop