what is the best way to check if the wifi is connected?
in forum i found:
1.
2.
are only these or there are another efficient methods to do that?
should be need to have a way that works for all devices.
thanks
alberto
in forum i found:
1.
B4X:
Sub Globals
Dim MyLan As ServerSocket
End Sub
Sub CheckForWiFi
If MyLan.GetMyIP = "127.0.0.1" Then '
Return False
Else
Return True
End If
End Sub
2.
B4X:
Sub CheckWiFi
Dim p As Phone 'Phone Library
If p.GetSettings ("wifi_on") <> 1 Then
MsgBox ("WiFi is OFF","")
Else 'WiFi is on
If p.GetDataState = "DISCONNECTED" Then ' Phone carrier's data network is disconnected
MsgBox ("WiFi is ON and CONNECTED","")
Else
MsgBox ("WiFi is ON but NOT connected to a WiFi network","")
End If
End If
End Sub
are only these or there are another efficient methods to do that?
should be need to have a way that works for all devices.
thanks
alberto