If I start the application over Wi-Fi and I switch to 3G, it prints 0, 15, so it's mobile network but I don't know why that subtype means. Then I switch back to Wi-Fi and it prints 0, 3 for a second (Mobile network, NETWORK_TYPE_UMTS) and displays that I'm connected to a mobile network on my UI, finaly it connects to Wi-Fi and it prints 1, 0. So what does 15 means? Docs doesn't say what are these values.
if (networkInfo != null && networkInfo.isConnected()) {
int netType = networkInfo.getType();
int netSubtype = networkInfo.getSubtype();
Log.d("Receiver", String.valueOf(netType));
Log.d("Receiver", String.valueOf(netSubtype));
if (netType == ConnectivityManager.TYPE_WIFI) {
Log.i("Receiver", "WiFi");
} else if (netType == ConnectivityManager.TYPE_MOBILE
&& netSubtype == TelephonyManager.NETWORK_TYPE_UMTS
&& !telephonyManager.isNetworkRoaming()) {
Log.i("Receiver", "Mobile");
}
}
http://developer.android.com/reference/android/net/NetworkInfo.html#getSubtype()