Android Question OkHttpUtils2 with Wait For resuming activity

JdV

Active Member
Licensed User
Longtime User
Hello

I have been using the simple example to download a simple page from a server which is often very slow to respond.

B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://slow-responding-server>/SomeFile.txt")

Wait For (j) JobDone(j As HttpJob)
If j.Success And IsPaused(Me) = False Then
   LabelInfo.Text = j.GetString
Else
  Log("Error: "&j.ErrorMessage
End If
j.Release

If I close the activity that's doing the downloading, when the download process eventually times out it resumes the downloading activity.

Previously I used a service to handle the downloading in order to avoid this happening. Is this possible when using 'wait for'?

Alternatively, is it possible to kill all download processes when the downloading activity is paused?

Regards

Joe
 

LucaMs

Expert
Licensed User
Longtime User
arrowDown.png
 
Upvote 0
Top