Android Question Wifi connection check problem (ABWifi)

Tayfur

Well-Known Member
Licensed User
Longtime User
Hello;
I want to check Wifi connection. Because My Phone's wifi range/state change in factory.
some time my code boreken when wifi lost. My code has "SMB library" and donload other lan PC.


I use the this code under below.

How is fix code? I want check wifi connection/state before "Samba" operations...


B4X:
Sub wifi_state() As Boolean

Dim r As Boolean
    Dim a As Int=0
    Dim x As Boolean
    r = myWifi.ABLoadWifi()
    If r = True Then
      If myWifi.ABGetCurrentWifiInfo().SSID.Trim<>"" Then x=True Else x=False
      'If myWifi.ABGetCurrentWifiInfo().IsConnected Then Msgbox("ok connect", "dxxx") Else Msgbox("not connect","3xxx")
      Msgbox (myWifi.ABGetCurrentWifiInfo().SSID, "")
      For a = 0 To myWifi.ABNumberOfAvailableWifiNetworks - 1
        Msgbox (myWifi.ABGetWifiNetwork(a).SSID & " " & myWifi.ABGetWifiNetwork(a).Level, "")
        'Return True
      Next
      'a=1
      'x=True
    Else
      Msgbox(myWifi.ABWifiLastError,"Wifi eror")
      'a=2
      x= False
    End If

    Return x
End Sub
 
Last edited:
Top