Hi all,
within my B4X (only mobile Android & iOS) app (that get data using REST API) I need to check if it is an internet connection before continue.
Searching the forum I found this interesting [B4X][B4XLib] by @LucaMs.
just to my knowledge, is it the only solution within the B4X framework to check the connection without having to write the code from scratch?
I think Erel recommends just trying the connection and if it fails just show some kind of message. i.e.: “there was some problem connecting to the source. Are you connected to internet?”
Hi all,
within my B4X (only mobile Android & iOS) app (that get data using REST API) I need to check if it is an internet connection before continue.
Searching the forum I found this interesting [B4X][B4XLib] by @LucaMs.
just to my knowledge, is it the only solution within the B4X framework to check the connection without having to write the code from scratch?
I m using this lib and it is very helpful without any problem. You can use google or other website to check it. I can say that checking with google.com is a little bit slow process to receive answer so use other webpage.
@José J. Aguilar and @pliroforikos thanks for your suggestions.
So I have to choose which is the best approach for my B4XPages app (Android & iOS).
basically, in my app, there are several places where this code is called:
B4X:
Dim j As HttpJob : j.Initialize("j", Me)
j.Username = aUser
j.Password = aPsw
Private WSUrl As String = WSNodeURL & nid & WSFormat
j.Download (WSUrl)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Private WSResponse As String = j.GetString2("UTF8")
End If
j.Release
So to prevent errors (ex. iOS Airplane mode) in my case I can handle this within else of "If j.Success Then", I guess.
so I have to then apply this across all occurrences of this code within my app, I guess.