Hi all How can I do something like this https://www.b4x.com/android/forum/threads/download-huge-files-with-httputils2.30220/ from B4J?
www.b4x.com
now tried to download two files in row...
I want to have to downloadprogress in the same sub... files downloading ok.. but second download not show the progress...
B4X:
Wait For (DownloadAndTrackProgress("https://www.mysite.com/myfile.ver", "myfile.ver")) Complete (Success1 As Boolean)
If Success1 Then
ProgressBar1.Progress=0
Wait For (DownloadAndTrackProgress("https://www.mysite.com/mysecondfile.txt", "mysecondfile.txt")) Complete (success As Boolean)
If success Then
...
Thought if "success" was different will be ok... but it is not the problem... seems that second time in row - can't get "taskid"... but why ?
Yes, you can't get taskid at 2nd time, doing TaskToJob is delayed, so you need add a TaskToJob.Size test in DownloadAndTrackProgress sub
B4X:
Private Sub DownloadAndTrackProgress (url As String, sFile As String) As ResumableSub
......
Dim TaskToJob As Map = HttpUtils2Service.TaskIdToJob
Do While HttpUtils2Service.TaskIdToJob.IsInitialized = False or TaskToJob.Size = 0
Sleep(30)
Loop
......
End Sub
Yes, you can't get taskid at 2nd time, doing TaskToJob is delayed, so you need add a TaskToJob.Size test in DownloadAndTrackProgress sub
B4X:
Private Sub DownloadAndTrackProgress (url As String, sFile As String) As ResumableSub
......
Dim TaskToJob As Map = HttpUtils2Service.TaskIdToJob
Do While HttpUtils2Service.TaskIdToJob.IsInitialized = False or TaskToJob.Size = 0
Sleep(30)
Loop
......
End Sub
Yes, you can't get taskid at 2nd time, doing TaskToJob is delayed, so you need add a TaskToJob.Size test in DownloadAndTrackProgress sub
B4X:
Private Sub DownloadAndTrackProgress (url As String, sFile As String) As ResumableSub
......
Dim TaskToJob As Map = HttpUtils2Service.TaskIdToJob
Do While HttpUtils2Service.TaskIdToJob.IsInitialized = False or TaskToJob.Size = 0
Sleep(30)
Loop
......
End Sub