Problem with ABWifi

vampire

New Member
I made simple program (using ABWifi) shows the following to me :
1. SSID
2. Is Connected
3. my MAC Address

the program woks good, but the problem is when I disconnect from Wifi network and run the app, it will stay show the last SSID .
BTW, (Is Connected) always return false even when I connected

this is the code :

B4X:
Sub Process_Globals
   
    Dim Wifi As ABWifi
      
End Sub

Sub Globals
   
   Dim btn1 As Button
   Dim Timer1 As Timer
   
   Dim lblIsconnected As Label
   Dim lblMac As Label
   Dim lblSSID As Label
      
End Sub

Sub Activity_Create(FirstTime As Boolean)

   Activity.LoadLayout("Main")
   
End Sub

Sub btn1_Click

   Timer1.Initialize("Timer1",2500)
   Timer1.Enabled=True 
   
End Sub

Sub Timer1_tick

        Dim RES As Boolean
   RES = Wifi.ABLoadWifi
   If RES = True Then
       lblSSID.Text=Wifi.ABGetCurrentWifiInfo.SSID
       lblMac.Text=Wifi.ABGetCurrentWifiInfo.MacAddress
   
       If Wifi.ABGetCurrentWifiInfo.IsConnected = True  Then
          lblIsconnected.Text="Connected"
       Else
          lblIsconnected.Text="Not Connected"
       End If 
   Else
      Msgbox(Wifi.ABWifiLastError,"Error")
   End If 

      Timer1.Enabled=False

End Sub
 
Last edited:

cbal03

Member
Licensed User
Longtime User
ABwifi always returns false for IsConnected

I've just downloaded this great library. I too noticed that IsConnected always returns false. I toggle airplane mode and switch to other accesspoints and notice that the other values change immediately (using a timer) but IsConnected doesn't change from its 'false' value.
 
Upvote 0

Clayton

Member
Licensed User
Longtime User
B4X:
Sub GetWifi()
  Dim info As ABWifiInfo

  Try
 
  MyWifi.ABLoadWifi
  info = MyWifi.ABGetCurrentWifiInfo
       
    If info.IsConnected = True Then
    Try
          lblWifi.Text = info.SSID
        ImgWifi.Visible = True
        If lblWifi.Text = "" Then ImgWifi.Visible =False
        Catch
            lblWifi.Text =""
            ImgWifi.Visible = False
        End Try
    Else
        ImgWifi.Visible = False
        lblWifi.Text = ""
    End If       

    Catch
        ImgWifi.Visible = False
        lblWifi.Text = ""
    End Try
'   
End Sub

info.IsConnected always returns false
 
Upvote 0
Top