Android Question Android 13+: how several HTTP-requests synchronously ?

peacemaker

Expert
Licensed User
Longtime User
Hi, All

If it needs to finish downloading 2....20 HTTP-requests to make a decision: how to download them ?
All must be downloaded without errors.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Dim results As List
results.Initialize
For Each url In urls
 Download(url, results)
Next
Do While results.Size < urls.Size
 Sleep(500)
Loop
Dim success As Boolean = True
For Each result As Boolean In results
 If result = False Then success = False
Next
Log(success)

Private Sub Download(url As String, results As List)
 'regular download using HttpJob
 results.Add(job.Success)
End Sub
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thanks, Erel.
Do you think, if server replies are not stable and are in 500 ... 5000 ms - will it also work OK ?
 
Upvote 0
Top