Feb 9, 2013 Replies: 2 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 GetWIFIName.zip 6.5 KB · Views: 1,240 Last edited: Mar 27, 2014 Click to expand...
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
Erel B4X founder Staff member Licensed User Longtime User Feb 10, 2013 #2 You can also use: Code: Dim server As ServerSocket If server.GetMyWifiIP = "127.0.0.1" Then Log("There is no wifi network.")
You can also use: Code: Dim server As ServerSocket If server.GetMyWifiIP = "127.0.0.1" Then Log("There is no wifi network.")
stevel05 Expert Licensed User Longtime User Feb 10, 2013 #3 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: Feb 10, 2013
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