Hi guys, I used this code to check internet connection. It worked correctly on Android 2.3.X but on 4.0.3 it's always said there's no internet connection. How can I fix it? Thank you :sign0188:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If CheckConnection Then
Msgbox("You connected internet", "OK")
Else
Msgbox("You didn't connect internet", "Error")
End If
End Sub
Sub CheckConnection As Boolean
Dim p As Phone
If (p.GetDataState == "CONNECTED") Then
Return True
End If
If (p.GetSettings ("wifi_on") == 1) Then
Return True
End If
If (p.GetDataState == "DISCONNECTED") Then
Return False
End If
If (p.GetDataState == "SUSPENDED") Then
Return False
End If
End Sub
Last edited: