Using ABWifiInfo How to Validate WiFi Is Connected

CharlesIPTI

Active Member
Licensed User
Longtime User
Does anyone see a glaring error here?? Because Assuredly ONE of my wifi connections IS connected but the results of this little method all say no connection is actually connected:
B4X:
Sub WiFiTwo

Dim r As Boolean
Dim a As Int 
Dim nFo As ABWifiInfo 
r = myWifi.ABLoadWifi() 

nFo = myWifi.ABGetCurrentWifiInfo() 
Msgbox("Connected 0 :: " & nFo.IsConnected, "")

If r = True Then
Msgbox (myWifi.ABGetCurrentWifiInfo().SSID, "")

For a = 0 To myWifi.ABNumberOfAvailableWifiNetworks - 1

Msgbox(myWifi.ABGetWifiNetwork(a).SSID & " " & 
myWifi.ABGetWifiNetwork(a).Level & " " & 
myWifi.ABGetWifiNetwork(a).IsConnected, "")

Next
Else
Msgbox(myWifi.ABWifiLastError,"") 
End If
End Sub

IS this more appropriate then ??? I had hoped I could check the Is Connected..


B4X:
    Sub WiFiThree  

        Dim r As Boolean 
                 Dim a As Int         
        Dim nFo As ABWifiInfo                  
         
    r = myWifi.ABLoadWifi()                 
        nFo = myWifi.ABGetCurrentWifiInfo()                         
        Msgbox(nFo, "") 
         
    If nFo <> Null Then 
        Msgbox ("Apparently it is connected", "PLPLP") 
         
    Else 
       Msgbox ("Apparently NO connection is active ", "PLPLP") 
    End If 
End Sub
 

vb1992

Well-Known Member
Licensed User
Longtime User
Wifi Connected Small Library

The attached small project and mini library shows if you are currently connected to WIFI

This sample is based on this small library I wrote:

- Requirements:

1- Library JAR and XML moved to your B4a Libraries directory
2- Sample Project
3- Internet wifi connection


NOTES:

I tested this in Airplane mode also,
then turning wifi on, and then running it.
It worked.

Tested in 2.3 Gingerbread
I didn't test this in ICS 4.X or 2.2 and under

Would be interested to know if it works for those android versions.
 

Attachments

  • Files.zip
    292.1 KB · Views: 811
Last edited:
Upvote 0

CharlesIPTI

Active Member
Licensed User
Longtime User
Thanks

Thanks its an industrial factory applicaiton on a galaxy Tab


I'll check this when I get my head above water from the SQLLite mess I'm in presently

... SQL.InsertMap wont insert Custom Type

Of Course Its not a map

but a list of Custom Types ...

:sign0161: :BangHead::BangHead:
 
Upvote 0

suciwulans

Active Member
Licensed User
Longtime User
hello
i want to make application which can search and connect to wifi network using ABWifi but i just can search the network. how about to connect? maybe one of you ever try to make it.
thankyou
 
Upvote 0

strubery

New Member
Licensed User
Longtime User
Wifi Connected Small Library

The attached small project and mini library shows if you are currently connected to WIFI

This sample is based on this small library I wrote:

- Requirements:

1- Library JAR and XML moved to your B4a Libraries directory
2- Sample Project
3- Internet wifi connection


NOTES:

I tested this in Airplane mode also,
then turning wifi on, and then running it.
It worked.

Tested in 2.3 Gingerbread
I didn't test this in ICS 4.X or 2.2 and under

Would be interested to know if it works for those android versions.
Hi
Works brilliantly on my Transformer Prime with Jelly Bean. Very simple but works effectively Thanks:)
 
Upvote 0
Top