title: Check whether mobile is using WIFI or Data/3G
body: <p>Assuming that both WIFI and Data/3G are enabled on a device, how do I check if the user is currently using the internet over the wifi or the data plan assuming they are both enabled. So I don't need to check if they are enabled or disabled, I would like to detect which one is the user actually using.</p>
  
  <p>I've been doing the following, is this the only solution?</p>
  
  <pre><code>WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
  WifiInfo wifiInfo = wifiManager.getConnectionInfo();
  if (WifiInfo.getDetailedStateOf(wifiInfo.getSupplicantState()) == NetworkInfo.DetailedState.CONNECTED) {
      String ssid = wifiInfo.getSSID();
  }
  </code></pre>