How i can know device is connected to Wifi or 3G, programmatically
Thanks
Checking the state of WiFi can be done by obtaining an instance to the WiFi system service as below: WifiManager wifi = (WifiManager)getSystemService(Context. WIFI_SERVICE); from this, the method isWifiEnabled() can be used to determine if WiFi is enabled.
Go to settings. Click on connections (or similar option). Find the Wifi option. This should reveal what network you are connected to.
you can use WifiManager class as mentioned here
Edit: by calling getConnectionInfo() function of WifiManager class you will get WifiInfo object
WifiInfo has function getBSSID() which gives you connected AP's name
if its null that means it is not connected to any AP via Wifi ( Wifi is not enabled )
btw while looking for more info, i found this which should answer all your questions about mobile connectivity and wifi connectivity
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With