Android Question Wait For (JOB) JobDone(JOB As HttpJob) closed the sub with out Exception

Martin Domian

Member
Licensed User
Longtime User
A very interesting case that I have presented here in the summarized code. The request runs perfectly. At the moment, however, I am on an island where the internet gets very bad towards the evening and also behaves strangely.

Then it actually happens that the line in which Job.Access is evaluated is no longer reached. The entire sub is terminated without an error message. Removing Try/Catch doesn't help either.

What could this be and how can you give the user a useful message


B4A:
private Sub LoadProjects
    
    Dim JOB As HttpJob, URL As String, F As String
    
    Try
        JOB.Initialize("PROJECTS", Me)
        JOB.PostString (URL,txt)
        JOB.GetRequest.SetHeader("User-Agent","Request Android App")
 
        Wait For (JOB) JobDone(JOB As HttpJob)
        If JOB.Success = True Then
            Dim X As JSONParser, M As Map, F As String
            F = JOB.GetString
            :
            :
        Else
          ToastMessageShow ("Error: " & JOB.ErrorMessage,False)
        End If
    Catch
        ToastMessageShow (LastException.message,False)
    End Try
    If JOB.IsInitialized Then JOB.Release
    
End Sub
 

Martin Domian

Member
Licensed User
Longtime User
Thank you for your help and for thinking along.
I've already tried it.
But that doesn't change anything and the routine is immediately abandoned.
I tried something else and called up a simple HTML site with "Hello alive". It behaves differently there and hangs forever.
Interesting. Now I've played the source on a remote computer and I work remotely there.
It works there ;-)
So it's the Internet. OK, it seems strange here, but I want the application to behave accordingly.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…