public int getNetworkType() {

        NetworkInfo activeNetworkInfo = getNetworkInfo();

        if (activeNetworkInfo != null) {
            // WIFI
            if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
                return NETWORK_CLASS_WIFI;
            }
            // MOBILE
            else if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
                return getMobileNetworkClass(activeNetworkInfo.getSubtype());
            }
        }

        return NETWORK_CLASS_UNKNOWN;
    }
public int getNetworkType() {

        NetworkInfo activeNetworkInfo = getNetworkInfo();

        if (activeNetworkInfo != null) {
            
            if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
                return NETWORK_CLASS_WIFI;
            }
            
            else if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
                return getMobileNetworkClass(activeNetworkInfo.getSubtype());
            }
        }

        return NETWORK_CLASS_UNKNOWN;
    }
public int getNetworkType ( ) { NetworkInfo activeNetworkInfo = getNetworkInfo ( ) ; if ( activeNetworkInfo != null ) { // WIFI if ( activeNetworkInfo . getType ( ) == ConnectivityManager . TYPE_WIFI ) { return NETWORK_CLASS_WIFI ; } // MOBILE else if ( activeNetworkInfo . getType ( ) == ConnectivityManager . TYPE_MOBILE ) { return getMobileNetworkClass ( activeNetworkInfo . getSubtype ( ) ) ; } } return NETWORK_CLASS_UNKNOWN ; }
2G/3G/4G/WIFI

@return
2G / 3G / 4G / WIFI