I am still struggling with getting a file either by httpUtils or FTP updated in time for the activity to be able to work with it.
If I use the FTP sub the file is downloaded if I am running in debug mode but the activity is too fast for it when running in release mode.
Alternatively, if I use the httpUtils method of getting the file it is not downloaded at all.
Can someone tell where I am going wrong please?
If I use the FTP sub the file is downloaded if I am running in debug mode but the activity is too fast for it when running in release mode.
Alternatively, if I use the httpUtils method of getting the file it is not downloaded at all.
Can someone tell where I am going wrong please?
B4X:
Sub UpdateHTTPFiles
If CheckConnection Then
RemoveOldFiles
Dim dd As DownloadData
Dim tmpTarget As String = File.Combine(File.DirRootExternal,"/diary.xml")
dd.url = link1
dd.EventName = "dd"
dd.Target = tmpTarget
CallSubDelayed2(DownloadService, "StartDownload", dd)
If File.Exists(File.DirRootExternal, "/diary.xml") Then
File.Copy(File.DirRootExternal,"/diary.xml",File.DirDefaultExternal,"/diary.xml")
File.Delete(File.DirRootExternal,"/diary.xml")
End If
parser.Initialize
SQL1.Initialize(File.DirDefaultExternal, "/diary.db", True)
CreateTables
ProgressDialogHide
ToastMessageShow("Files Updated!",True)
End If
End Sub
Sub UpdateFiles
If CheckConnection Then
RemoveOldFiles
ToastMessageShow("Checking for latest files",True)
FTP.Initialize("FTP", "FTPSite", 21, "Username", "Password")
FTP.DownloadFile("public_html/BMB/diary.xml", False, File.DirRootExternal, "/diary.xml")
If File.Exists(File.DirRootExternal, "/diary.xml") Then
File.Copy(File.DirRootExternal,"/diary.xml",File.DirDefaultExternal,"/diary.xml")
File.Delete(File.DirRootExternal,"/diary.xml")
End If
parser.Initialize
SQL1.Initialize(File.DirDefaultExternal, "/diary.db", True)
CreateTables
ProgressDialogHide
ToastMessageShow("Files Updated!",True)
End If
End Sub