Hello,
I am using the bellow function to test internet connection and works ok
But now i want app not to do anything until Internet will be available so i did this
When true it continues but when internet not available it does some work for a few tries but without waiting success continues the app and then the app crash.
Any idea?
I am using the bellow function to test internet connection and works ok
B4X:
Public Sub testInternet(url as String) As ResumableSub
Dim result As Boolean = False
Dim Job As HttpJob
Job.Initialize("Job", Me)
Job.Download(url)
Log ("Sending job")
Wait For(Job) JobDone(Job As HttpJob)
If Job.Success Then
result = True
Log("Success")
Else
result = False
Log("No connection...")
End If
Job.Release
Return result
End Sub
But now i want app not to do anything until Internet will be available so i did this
B4XMainPage:
Dim rst As Boolean = False
Do While rst = False
Wait for(testInternet("the url i want to test e.g. google.com")) Complete (rst As Boolean)
Loop
When true it continues but when internet not available it does some work for a few tries but without waiting success continues the app and then the app crash.
Any idea?