Android Question How to use WifiConnect Library

Jakes72

Active Member
Licensed User
Longtime User
Hi Code Masters,

I see there is a built in Wifi library in B4A (WifiConnect).
Could someone please give me a simple code snippet of how to use this?

I have added this to the Manifest (Not sure if I need them all):
B4X:
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.CHANGE_WIFI_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)

And my code so far is:
B4X:
Dim wifi As WiFiConnect
wifi.connectToSSID(wifi.WIFI_WPA,"MySSID","MyPassword")     '<--- I replace SSID and Password with my real credentials

This does not give any errors, but how do I know I am connected, ie. what are the events I must respond to? How do I send/receive data?

Thank you for your time,

Regards,
Jacques.
 

Gabino A. de la Gala

Active Member
Licensed User
Longtime User
Perhaps this can help you:

 
Upvote 0

Jakes72

Active Member
Licensed User
Longtime User
Hi Gabino, thanks for the reply.

But must I use Java methods?
What is the purpose of the built in WifiConnect library then?

Regards,
Jacques.
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Why not this:

 
Upvote 0

Jakes72

Active Member
Licensed User
Longtime User
Thanks for all the answers guys.
I am just still puzzled though, must I not use the built in library ' WifiConnect ' then?
Erel can you maybe shed some light? :)
 
Upvote 0
Top