当前位置: 首页>>代码示例>>Java>>正文


Java TelephonyManager.NETWORK_TYPE_UNKNOWN属性代码示例

本文整理汇总了Java中android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN属性的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.NETWORK_TYPE_UNKNOWN属性的具体用法?Java TelephonyManager.NETWORK_TYPE_UNKNOWN怎么用?Java TelephonyManager.NETWORK_TYPE_UNKNOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.telephony.TelephonyManager的用法示例。


在下文中一共展示了TelephonyManager.NETWORK_TYPE_UNKNOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keyForNetwork

/**
 * Get the preference <b>partial</b> key for a given network kind
 * 
 * @param networkType Type of the network {@link ConnectivityManager}
 * @param subType Subtype of the network {@link TelephonyManager}
 * @return The partial key for the network kind
 */
private static String keyForNetwork(int networkType, int subType) {
    if (networkType == ConnectivityManager.TYPE_WIFI) {
        return "wifi";
    } else if (networkType == ConnectivityManager.TYPE_MOBILE) {
        // 3G (or better)
        if (subType >= TelephonyManager.NETWORK_TYPE_UMTS) {
            return "3g";
        }

        // GPRS (or unknown)
        if (subType == TelephonyManager.NETWORK_TYPE_GPRS
                || subType == TelephonyManager.NETWORK_TYPE_UNKNOWN) {
            return "gprs";
        }

        // EDGE
        if (subType == TelephonyManager.NETWORK_TYPE_EDGE) {
            return "edge";
        }
    }

    return "other";
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:30,代码来源:SipConfigManager.java

示例2: isValidMobileConnectionFor

private boolean isValidMobileConnectionFor(NetworkInfo ni, String suffix) {

        boolean valid_for_3g = getPreferenceBooleanValue("use_3g_" + suffix, false);
        boolean valid_for_edge = getPreferenceBooleanValue("use_edge_" + suffix, false);
        boolean valid_for_gprs = getPreferenceBooleanValue("use_gprs_" + suffix, false);
        boolean valid_for_roaming = getPreferenceBooleanValue("use_roaming_" + suffix, true);
        
        if(!valid_for_roaming && ni != null) {
            if(ni.isRoaming()) {
                return false;
            }
        }
        
        if ((valid_for_3g || valid_for_edge || valid_for_gprs) &&
                ni != null) {
            int type = ni.getType();

            // Any mobile network connected
            if (ni.isConnected() &&
                    // Type 3,4,5 are other mobile data ways
                    (type == ConnectivityManager.TYPE_MOBILE || (type <= 5 && type >= 3))) {
                int subType = ni.getSubtype();

                // 3G (or better)
                if (valid_for_3g &&
                        subType >= TelephonyManager.NETWORK_TYPE_UMTS) {
                    return true;
                }

                // GPRS (or unknown)
                if (valid_for_gprs
                        &&
                        (subType == TelephonyManager.NETWORK_TYPE_GPRS || subType == TelephonyManager.NETWORK_TYPE_UNKNOWN)) {
                    return true;
                }

                // EDGE
                if (valid_for_edge &&
                        subType == TelephonyManager.NETWORK_TYPE_EDGE) {
                    return true;
                }
            }
        }
        return false;
    }
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:45,代码来源:PreferencesProviderWrapper.java

示例3: isConnectionSlow

/**
 * <p>Serves <code>isConnectedConnectionSlow</code> public methods with a way to detect the
 * current sub type connection of MOBILE type.</p>
 *
 * @param type    of connection either WIFI or MOBILE.
 * @param subType of a MOBILE connection type.
 * @return <code>true</code> if MOBILE data speed of about 14kbps to 100kbps
 * <code>false</code> otherwise.
 */
private static boolean isConnectionSlow(int type, int subType) {
    if (type == ConnectivityManager.TYPE_WIFI) {
        return false;
    } else if (type == ConnectivityManager.TYPE_MOBILE) {
        switch (subType) {
            // Speeds of about ~ 50 to 100 kbps
            case TelephonyManager.NETWORK_TYPE_1xRTT:
                return true;
            // Speeds of about ~ 14 to 64 kbps
            case TelephonyManager.NETWORK_TYPE_CDMA:
                return true;
            // Speeds of about ~ 50 to 100 kbps
            case TelephonyManager.NETWORK_TYPE_EDGE:
                return true;
            // Speeds of about ~ 100 kbps
            case TelephonyManager.NETWORK_TYPE_GPRS:
                return true;
            // Speeds of about ~ 25 kbps
            case TelephonyManager.NETWORK_TYPE_IDEN:
                return true;
            // Otherwise
            case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            default:
                return false;
        }
    } else {
        return false;
    }
}
 
开发者ID:alkathirikhalid,项目名称:connection,代码行数:38,代码来源:Connection.java

示例4: getRatFromInt

/**
 * Get a human-readable string of RAT/Network Type
 *
 * Frustratingly it looks like the app uses RAT & Network Type interchangably with both either
 * being an integer representation (TelephonyManager's constants) or a human-readable string.
 *
 * @param netType The integer representation of the network type, via TelephonyManager
 * @return Human-readable representation of network type (e.g. "EDGE", "LTE")
 */
public static String getRatFromInt(int netType) {
    switch (netType) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return "1xRTT";
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return "CDMA";
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return "EDGE";
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return "eHRPD";
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return "EVDO rev. 0";
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return "EVDO rev. A";
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return "EVDO rev. B";
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return "GPRS";
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return "HSDPA";
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return "HSPA";
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return "HSPA+";
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return "HSUPA";
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return "iDen";
        case TelephonyManager.NETWORK_TYPE_LTE:
            return "LTE";
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return "UMTS";
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return "Unknown";
        default:
            return String.valueOf(netType);
    }
}
 
开发者ID:5GSD,项目名称:AIMSICDL,代码行数:47,代码来源:Cell.java

示例5: isFastMobileNetwork

/**
 * Whether is fast mobile network
 * 
 * @param context
 * @return
 */
private static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager == null) {
        return false;
    }

    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false;
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false;
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false;
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true;
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false;
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true;
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true;
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false;
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true;
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:harrylefit,项目名称:eazycore,代码行数:49,代码来源:NetWorkUtils.java

示例6: isFastMobileNetwork

/**
 * Whether is fast mobile network
 *
 * @param context
 * @return
 */
private static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager == null) {
        return false;
    }

    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false;
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false;
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false;
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true;
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false;
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true;
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true;
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false;
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true;
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:49,代码来源:NetUtil.java

示例7: getNetworkSpeedModeInMobile

/**
 * 仅判断Mobile网络的慢速.蓝牙等其他网络不做判断.
 *
 * @param context
 * @return
 */
public static NetworkSpeedMode getNetworkSpeedModeInMobile(Context context) {
    ConnectivityManager connectivityManager = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    if (connectivityManager != null) {
        NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
        if (networkInfo != null) {
            if (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
                switch (networkInfo.getSubtype()) {
                    case TelephonyManager.NETWORK_TYPE_IDEN: // ~25 kbps
                        return NetworkSpeedMode.LOW;
                    case TelephonyManager.NETWORK_TYPE_CDMA: // ~ 14-64 kbps
                        return NetworkSpeedMode.LOW;
                    case TelephonyManager.NETWORK_TYPE_1xRTT: // ~ 50-100 kbps
                        return NetworkSpeedMode.LOW;
                    case TelephonyManager.NETWORK_TYPE_EDGE: // ~ 50-100 kbps
                        return NetworkSpeedMode.LOW;
                    case TelephonyManager.NETWORK_TYPE_GPRS: // ~ 100 kbps
                        return NetworkSpeedMode.LOW;

                    case TelephonyManager.NETWORK_TYPE_EVDO_0: // ~ 400-1000
                        // kbps
                        return NetworkSpeedMode.NORMAL;
                    case TelephonyManager.NETWORK_TYPE_EVDO_A: // ~ 600-1400
                        // kbps
                        return NetworkSpeedMode.NORMAL;
                    case TelephonyManager.NETWORK_TYPE_HSPA: // ~ 700-1700 kbps
                        return NetworkSpeedMode.NORMAL;
                    case TelephonyManager.NETWORK_TYPE_UMTS: // ~ 400-7000 kbps
                        return NetworkSpeedMode.NORMAL;
                    case 14: // TelephonyManager.NETWORK_TYPE_EHRPD: // ~ 1-2
                        // Mbps
                        return NetworkSpeedMode.NORMAL;
                    case 12: // TelephonyManager.NETWORK_TYPE_EVDO_B: // ~ 5
                        // Mbps
                        return NetworkSpeedMode.NORMAL;

                    case TelephonyManager.NETWORK_TYPE_HSDPA: // ~ 2-14 Mbps
                        return NetworkSpeedMode.HIGH;
                    case TelephonyManager.NETWORK_TYPE_HSUPA: // ~ 1-23 Mbps
                        return NetworkSpeedMode.HIGH;
                    case 15: // TelephonyManager.NETWORK_TYPE_HSPAP: // ~ 10-20
                        // Mbps
                        return NetworkSpeedMode.HIGH;
                    case 13: // TelephonyManager.NETWORK_TYPE_LTE: // ~ 10+ Mbps
                        return NetworkSpeedMode.HIGH;

                    case TelephonyManager.NETWORK_TYPE_UNKNOWN:
                        return NetworkSpeedMode.NORMAL;
                    default:
                        break;
                }
            }
        }
    }
    return NetworkSpeedMode.UNKNOWN;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:62,代码来源:NetworkUtil.java

示例8: isFastMobileNetwork

private static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager == null) {
        return false;
    }

    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false;
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false;
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false;
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true;
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false;
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true;
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true;
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false;
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true;
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:43,代码来源:Kits.java

示例9: isFastMobileNetwork

/**
 * Do you have a fast mobile network?
 *
 * @param context context
 * @return Do you have a fast mobile network? [boolean]
 */
private static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    if (telephonyManager == null) return false;
    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false;
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false;
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false;
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true;
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false;
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true;
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true;
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false;
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true;
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:Jusenr,项目名称:androidtools,代码行数:46,代码来源:NetworkUtils.java

示例10: isFastMobileNetwork

/**
 * Whether is fast mobile network
 *
 * @param context context
 * @return FastMobileNetwork
 */
private static boolean isFastMobileNetwork(Context context) {
    TelephonyManager telephonyManager
            = (TelephonyManager) context.getSystemService(
            Context.TELEPHONY_SERVICE);
    if (telephonyManager == null) {
        return false;
    }

    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false;
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false;
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false;
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true;
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false;
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true;
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true;
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true;
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true;
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true;
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false;
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true;
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:liying2008,项目名称:Simpler,代码行数:51,代码来源:NetWorkUtils.java

示例11: runNDT

public void runNDT()
{
    final NDTRunner ndtRunner = new NDTRunner();
    ndtRunnerHolder.set(ndtRunner);
    
    Log.d(LOG_TAG, "ndt status RUNNING");
    
    final String ndtNetworkType;
    final int networkType = getNetworkType();
    switch (networkType)
    {
    case InformationCollector.NETWORK_WIFI:
        ndtNetworkType = NdtTests.NETWORK_WIFI;
        break;
    
    case TelephonyManager.NETWORK_TYPE_UNKNOWN:
        ndtNetworkType = NdtTests.NETWORK_UNKNOWN;
        break;
    
    default:
        ndtNetworkType = NdtTests.NETWORK_MOBILE;
        break;
    }
    
    ndtRunner.runNDT(ndtNetworkType, ndtRunner.new UiServices()
    {
        
        @Override
        public void sendResults()
        {
            client.getControlConnection().sendNDTResult(this, null);
        }
        
        public boolean wantToStop()
        {
            if (super.wantToStop())
                return true;
            
            if (cancelled.get())
            {
                cancel();
                return true;
            }
            return false;
        }
    });
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:47,代码来源:RMBTTask.java

示例12: isConnectionFast

/**
 * <p>Serves <code>isConnectedConnectionFast</code> public methods with a way to detect the
 * current sub type connection of MOBILE type.</p>
 *
 * @param type    of connection either WIFI or MOBILE.
 * @param subType of a MOBILE connection type.
 * @return <code>true</code> if WIFI or if MOBILE data speed of about 400kbps to 23Mbps
 * <code>false</code> otherwise.
 */
private static boolean isConnectionFast(int type, int subType) {
    if (type == ConnectivityManager.TYPE_WIFI) {
        return true;
    } else if (type == ConnectivityManager.TYPE_MOBILE) {
        switch (subType) {
            // Speeds of about ~ 400 to 1000 kbps
            case TelephonyManager.NETWORK_TYPE_EVDO_0:
                return true;
            // Speeds of about ~ 600 to 1400 kbps.
            case TelephonyManager.NETWORK_TYPE_EVDO_A:
                return true;
            // Speeds of about ~ 2 to 14 Mbps.
            case TelephonyManager.NETWORK_TYPE_HSDPA:
                return true;
            // Speeds of about ~ 700 to 1700 kbps
            case TelephonyManager.NETWORK_TYPE_HSPA:
                return true;
            // Speeds of about ~ 1 to 23 Mbps
            case TelephonyManager.NETWORK_TYPE_HSUPA:
                return true;
            // Speeds of about ~ 400 to 7000 kbps
            case TelephonyManager.NETWORK_TYPE_UMTS:
                return true;
            // Speeds of about ~ 1 to 2 Mbps
            case TelephonyManager.NETWORK_TYPE_EHRPD:
                return true;
            // Speeds of about ~ 5 Mbps
            case TelephonyManager.NETWORK_TYPE_EVDO_B:
                return true;
            // Speeds of about ~ 10 to 20 Mbps
            case TelephonyManager.NETWORK_TYPE_HSPAP:
                return true;
            // Speeds of about ~ 10+ Mbps
            case TelephonyManager.NETWORK_TYPE_LTE:
                return true;
            // Otherwise
            case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            default:
                return false;
        }
    } else {
        return false;
    }
}
 
开发者ID:alkathirikhalid,项目名称:connection,代码行数:53,代码来源:Connection.java

示例13: isConnectionFast

/**
 * Check if the connection is fast
 * @param type
 * @param subType
 * @return
 */
public static boolean isConnectionFast(int type, int subType){
	if(type==ConnectivityManager.TYPE_WIFI){
		return true;
	}else if(type==ConnectivityManager.TYPE_MOBILE){
		switch(subType){
			case TelephonyManager.NETWORK_TYPE_1xRTT:
				return false; // ~ 50-100 kbps
			case TelephonyManager.NETWORK_TYPE_CDMA:
				return false; // ~ 14-64 kbps
			case TelephonyManager.NETWORK_TYPE_EDGE:
				return false; // ~ 50-100 kbps
			case TelephonyManager.NETWORK_TYPE_EVDO_0:
				return true; // ~ 400-1000 kbps
			case TelephonyManager.NETWORK_TYPE_EVDO_A:
				return true; // ~ 600-1400 kbps
			case TelephonyManager.NETWORK_TYPE_GPRS:
				return false; // ~ 100 kbps
			case TelephonyManager.NETWORK_TYPE_HSDPA:
				return true; // ~ 2-14 Mbps
			case TelephonyManager.NETWORK_TYPE_HSPA:
				return true; // ~ 700-1700 kbps
			case TelephonyManager.NETWORK_TYPE_HSUPA:
				return true; // ~ 1-23 Mbps
			case TelephonyManager.NETWORK_TYPE_UMTS:
				return true; // ~ 400-7000 kbps
		/*
		 * Above API level 7, make sure to set android:targetSdkVersion
		 * to appropriate level to use these
		 */
			case TelephonyManager.NETWORK_TYPE_EHRPD: // API level 11
				return true; // ~ 1-2 Mbps
			case TelephonyManager.NETWORK_TYPE_EVDO_B: // API level 9
				return true; // ~ 5 Mbps
			case TelephonyManager.NETWORK_TYPE_HSPAP: // API level 13
				return true; // ~ 10-20 Mbps
			case TelephonyManager.NETWORK_TYPE_IDEN: // API level 8
				return false; // ~25 kbps
			case TelephonyManager.NETWORK_TYPE_LTE: // API level 11
				return true; // ~ 10+ Mbps
			// Unknown
			case TelephonyManager.NETWORK_TYPE_UNKNOWN:
			default:
				return false;
		}
	}else{
		return false;
	}
}
 
开发者ID:Gookler,项目名称:RxJanDan,代码行数:54,代码来源:Connectivity.java

示例14: isFastNetwork

/**
 * 判断是否是快速网络,将3G或者3G以上的网络称为快速网络
 *
 * @return true  快速网络,false 非快速网络
 */
public static boolean isFastNetwork() {

    TelephonyManager telephonyManager = (TelephonyManager) UtilManager.getContext()
            .getSystemService(Context.TELEPHONY_SERVICE);

    switch (telephonyManager.getNetworkType()) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return false; // ~ 50-100 kbps
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return false; // ~ 14-64 kbps
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return false; // ~ 50-100 kbps
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return true; // ~ 400-1000 kbps
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return true; // ~ 600-1400 kbps
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return false; // ~ 100 kbps
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return true; // ~ 2-14 Mbps
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return true; // ~ 700-1700 kbps
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return true; // ~ 1-23 Mbps
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return true; // ~ 400-7000 kbps
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return true; // ~ 1-2 Mbps
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return true; // ~ 5 Mbps
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return true; // ~ 10-20 Mbps
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return false; // ~25 kbps
        case TelephonyManager.NETWORK_TYPE_LTE:
            return true; // ~ 10+ Mbps
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            return false;
        default:
            return false;
    }
}
 
开发者ID:sundevin,项目名称:utilsLibrary,代码行数:47,代码来源:NetworkUtils.java

示例15: getNetwork

/** Returns the network that the phone is on (e.g. Wifi, Edge, GPRS, etc). */
public int getNetwork()
{
    int result = TelephonyManager.NETWORK_TYPE_UNKNOWN;
    
    if (connManager != null)
    {
        final NetworkInfo activeNetworkInfo = connManager.getActiveNetworkInfo();
        if (activeNetworkInfo != null)
        {
            final int type = activeNetworkInfo.getType();
            switch (type)
            {
            case ConnectivityManager.TYPE_WIFI:
                result = NETWORK_WIFI;
                break;
                
            case ConnectivityManager.TYPE_BLUETOOTH:
                result = NETWORK_BLUETOOTH;
                break;
                
            case ConnectivityManager.TYPE_ETHERNET:
                result = NETWORK_ETHERNET;
                break;
                
            case ConnectivityManager.TYPE_MOBILE:
            case ConnectivityManager.TYPE_MOBILE_DUN:
            case ConnectivityManager.TYPE_MOBILE_HIPRI:
            case ConnectivityManager.TYPE_MOBILE_MMS:
            case ConnectivityManager.TYPE_MOBILE_SUPL:
                //NetworkInfo.getSubtype() will return
                //one int representing an TelephonyManager.NETWORK_TYPE_XXX,
                //even if this is not documented
                //see https://dl.google.com/io/2009/pres/W_0300_CodingforLife-BatteryLifeThatIs.pdf
                //    https://stackoverflow.com/questions/25414830/networkinfo-subtype-values
                result = activeNetworkInfo.getSubtype();
                break;
            }
        }
    }
    
    /* detect change from wifi to mobile or reverse */
    final int lastNetworkType = this.lastNetworkType.get();
    if (result != TelephonyManager.NETWORK_TYPE_UNKNOWN && lastNetworkType != TelephonyManager.NETWORK_TYPE_UNKNOWN)
    {
        if (
            (result == NETWORK_WIFI && lastNetworkType != NETWORK_WIFI)
                ||
            (result != NETWORK_WIFI && lastNetworkType == NETWORK_WIFI)
            )
            illegalNetworkTypeChangeDetcted.set(true);
    }
    if (result != lastNetworkType)
    {
        this.lastNetworkType.set(result);
        if (telListener != null)
            telListener.onSignalStrengthsChanged(null);
    }
        
    return result;
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:61,代码来源:InformationCollector.java


注:本文中的android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。