I am struggling to understand how to manage ftp when the user taps the Home Button.
I have the following
If this runs with a large source file and the Home key is pressed a few things happen
1. I get a lot of errors about too many queued events ftp_downloadprogress
2. The 100 files don't all get downloded
3. FTP.List and it's associated completed sub never get executed
Obviously the App comes back into Activity.Resume but I don't think I can put this code in there as the loop would be started all over again
Any help would be greatly appreciated.
(Still trying to get my head around Async coding)
Basically I cannot continue with application logic until the FTP task has completed but I never know when that happens if the user does something unexpected
I have the following
B4X:
For i = 1 to 100 'don't worry why, it's just for testing
Dim sf As Object = FTP.DownloadFile(SourceFile False, PathSettings, TargetFile)
Wait For (sf) FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
If Success Then
Log("file was downloaded successfully")
Else
Log("Error uploading file")
End If
Next
FTP.List("/")
If this runs with a large source file and the Home key is pressed a few things happen
1. I get a lot of errors about too many queued events ftp_downloadprogress
2. The 100 files don't all get downloded
3. FTP.List and it's associated completed sub never get executed
Obviously the App comes back into Activity.Resume but I don't think I can put this code in there as the loop would be started all over again
Any help would be greatly appreciated.
(Still trying to get my head around Async coding)
Basically I cannot continue with application logic until the FTP task has completed but I never know when that happens if the user does something unexpected
Last edited: