I am trying to understand how to work with the ConnectivityManager, and while I see some good samples Here and Here as well as on the Official documentation.
I already have a BroadcastReceiver setup and listens to the "android.net.conn.CONNECTIVITY_CHANGE" Intent, but I am still confused about how exactly should I figure out the following pseudo logic:
String result = null;
if (WifiConnected)
result = "Wifi: " + getWifiName();//or ID that can be related to the list of Wifi networks on the device
else if (MobileDataConnected)
{
String networktype = GetMobileNetworkType();//2G/3G/4G
String roaming = IsMobileRoaming();//Roam/Home
result = "Mobile: " + networktype + " " + roaming;
}
else
{
result = "Not connected";
}
Any help will be greatly appreciated,
Thanks.