B4A Library [Utility Code] GetWIFIName

It seemed to be difficult to determine whether a device was connected to wifi or mobile network or not so I looked at the Android Developer site and found the ConnectivityManager

I couldn't find it anywhere else so here's is a small piece of Reflection code that returns the name of the Current WIFI connection as WIFI, mobile, none etc. Apparently it will return quite a few more which are documented in the above link but I can't test them.

It works on the three I have available.

It also requires the reflection library and a permission to be added to the Manifest:

AddPermission (android.permission.ACCESS_NETWORK_STATE)

The attached file has the code in a small module and creates a msgbox to display the current value.

I hope someone finds this useful.

Tags: Wifi Name Connect
 

Attachments

  • GetWIFIName.zip
    6.5 KB · Views: 860
Last edited:

stevel05

Expert
Licensed User
Longtime User
Thanks Erel,

I played with this which made me look further as I particularly wanted to know if the phone was using a mobile data network, as opposed to WiFi.

via Tapatalk
 
Last edited:
Top