How do you detect the network connection type on Android?
Is it through ConnectivityManager.getActiveNetworkInfo().getType(), and is the answer limited
@Emil's answer above is brilliant.
Small addition: We should ideally use TelephonyManager to detect network types. So the above should instead read:
/**
* Check if there is fast connectivity
* @param context
* @return
*/
public static boolean isConnectedFast(Context context){
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return (info != null && info.isConnected() && Connectivity.isConnectionFast(info.getType(), tm.getNetworkType()));
}