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


Java TelephonyManager.NETWORK_TYPE_EVDO_A属性代码示例

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


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

示例1: getCurrentNetType

/**
 * 得到当前的手机网络类型
 * 
 * @param context
 * @return
 */ 
public static String getCurrentNetType(Context context) { 
    String type = ""; 
    ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 
    NetworkInfo info = cm.getActiveNetworkInfo(); 
    if (info == null) { 
        type = "null"; 
    } else if (info.getType() == ConnectivityManager.TYPE_WIFI) { 
        type = "wifi"; 
    } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) { 
        int subType = info.getSubtype(); 
        if (subType == TelephonyManager.NETWORK_TYPE_CDMA || subType == TelephonyManager.NETWORK_TYPE_GPRS 
                || subType == TelephonyManager.NETWORK_TYPE_EDGE) { 
            type = "2g"; 
        } else if (subType == TelephonyManager.NETWORK_TYPE_UMTS || subType == TelephonyManager.NETWORK_TYPE_HSDPA 
                || subType == TelephonyManager.NETWORK_TYPE_EVDO_A || subType == TelephonyManager.NETWORK_TYPE_EVDO_0 
                || subType == TelephonyManager.NETWORK_TYPE_EVDO_B) { 
            type = "3g"; 
        } else if (subType == TelephonyManager.NETWORK_TYPE_LTE) {// LTE是3g到4g的过渡,是3.9G的全球标准 
            type = "4g"; 
        } 
    } 
    return type; 
}
 
开发者ID:AnnyBaby,项目名称:Mvp-Retrofit-Rxjava-Rxbus,代码行数:29,代码来源:AppInfoUtils.java

示例2: getNetworkClass

@ReactMethod
public void getNetworkClass(Callback successCallback) {
    int networkType = telephonyManager.getNetworkType();
    String network;

    switch (networkType) {
        case TelephonyManager.NETWORK_TYPE_GPRS:
        case TelephonyManager.NETWORK_TYPE_EDGE:
        case TelephonyManager.NETWORK_TYPE_CDMA:
        case TelephonyManager.NETWORK_TYPE_1xRTT:
        case TelephonyManager.NETWORK_TYPE_IDEN:
            network = "2G";
            break;
        case TelephonyManager.NETWORK_TYPE_UMTS:
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
        case TelephonyManager.NETWORK_TYPE_HSDPA:
        case TelephonyManager.NETWORK_TYPE_HSUPA:
        case TelephonyManager.NETWORK_TYPE_HSPA:
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
        case TelephonyManager.NETWORK_TYPE_EHRPD:
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            network = "3G";
            break;
        case TelephonyManager.NETWORK_TYPE_LTE:
            network = "4G";
            break;
        default:
            network = "Unknown";
            break;
    }

    successCallback.invoke(network);
}
 
开发者ID:rafaellincoln,项目名称:react-native-telephony,代码行数:34,代码来源:TelephonyModule.java

示例3: getNetworkTypeForLink

public static int getNetworkTypeForLink(Context context) {
    try {
        ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();
        if (ni != null) {
            if (ni.getType() == ConnectivityManager.TYPE_WIFI) {
                return LinkNetWorkType.WIFI;
            } else {
                if (ni.getType() == ConnectivityManager.TYPE_MOBILE) {
                    switch (ni.getSubtype()) {
                    case TelephonyManager.NETWORK_TYPE_GPRS:
                    case TelephonyManager.NETWORK_TYPE_EDGE:
                    case TelephonyManager.NETWORK_TYPE_CDMA:
                    case TelephonyManager.NETWORK_TYPE_1xRTT:
                    case TelephonyManager.NETWORK_TYPE_IDEN:
                        return LinkNetWorkType._2G;
                    case TelephonyManager.NETWORK_TYPE_UMTS:
                    case TelephonyManager.NETWORK_TYPE_EVDO_0:
                    case TelephonyManager.NETWORK_TYPE_EVDO_A:
                    case TelephonyManager.NETWORK_TYPE_HSDPA:
                    case TelephonyManager.NETWORK_TYPE_HSUPA:
                    case TelephonyManager.NETWORK_TYPE_HSPA:
                    case 12: // TelephonyManager.NETWORK_TYPE_EVDO_B:
                    case 14: // TelephonyManager.NETWORK_TYPE_EHRPD:
                    case 15: // TelephonyManager.NETWORK_TYPE_HSPAP:
                        return LinkNetWorkType._3G;
                    case 13: // TelephonyManager.NETWORK_TYPE_LTE:
                        return LinkNetWorkType._4G;
                    default:
                        return LinkNetWorkType._2G;
                    }
                }
            }
        }
    } catch (Exception e) {
        return LinkNetWorkType.UNKNOWN;
    }
    return LinkNetWorkType.UNKNOWN;
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:39,代码来源:NetworkUtil.java

示例4: 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

示例5: getNetworkTypeNameInMobile

private static String getNetworkTypeNameInMobile(int type) {
    switch (type) {
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return "GPRS";
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return "EDGE";
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return "UMTS";
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return "HSDPA";
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return "HSUPA";
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return "HSPA";
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return "CDMA";
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return "CDMA - EvDo rev. 0";
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return "CDMA - EvDo rev. A";
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return "CDMA - EvDo rev. B";
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return "CDMA - 1xRTT";
        case TelephonyManager.NETWORK_TYPE_LTE:
            return "LTE";
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return "CDMA - eHRPD";
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return "iDEN";
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return "HSPA+";
        default:
            return "UNKNOWN";
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:36,代码来源:NetworkUtil.java

示例6: getNetworkType

/**
 * 获取网络状态,wifi,wap,2g,3g,4g.
 *
 * @return int 网络状态 {@link #NETWORK_TYPE_2G},{@link #NETWORK_TYPE_3G},{@link #NETWORK_TYPE_4G}
 * {@link #NETWORK_TYPE_INVALID},{@link #NETWORK_TYPE_WAP},
 * {@link #NETWORK_TYPE_WIFI}
 */
public static int getNetworkType() {
    int strNetworkType = NETWORK_TYPE_INVALID;

    NetworkInfo networkInfo = ((ConnectivityManager) UtilManager.getContext().getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo();
    if (networkInfo != null && networkInfo.isConnected()) {
        if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
            strNetworkType = NETWORK_TYPE_WIFI;
        } else if (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
            String _strSubTypeName = networkInfo.getSubtypeName();

            // TD-SCDMA   networkType is 17
            int networkType = networkInfo.getSubtype();
            switch (networkType) {
                case TelephonyManager.NETWORK_TYPE_GPRS:
                case TelephonyManager.NETWORK_TYPE_EDGE:
                case TelephonyManager.NETWORK_TYPE_CDMA:
                case TelephonyManager.NETWORK_TYPE_1xRTT:
                case TelephonyManager.NETWORK_TYPE_IDEN: //api<8 : replace by 11
                    strNetworkType = NETWORK_TYPE_2G;
                    break;
                case TelephonyManager.NETWORK_TYPE_UMTS:
                case TelephonyManager.NETWORK_TYPE_EVDO_0:
                case TelephonyManager.NETWORK_TYPE_EVDO_A:
                case TelephonyManager.NETWORK_TYPE_HSDPA:
                case TelephonyManager.NETWORK_TYPE_HSUPA:
                case TelephonyManager.NETWORK_TYPE_HSPA:
                case TelephonyManager.NETWORK_TYPE_EVDO_B: //api<9 : replace by 14
                case TelephonyManager.NETWORK_TYPE_EHRPD:  //api<11 : replace by 12
                case TelephonyManager.NETWORK_TYPE_HSPAP:  //api<13 : replace by 15
                    strNetworkType = NETWORK_TYPE_3G;
                    break;
                case TelephonyManager.NETWORK_TYPE_LTE:    //api<11 : replace by 13
                    strNetworkType = NETWORK_TYPE_4G;
                    break;
                default:
                    // http://baike.baidu.com/item/TD-SCDMA 中国移动 联通 电信 三种3G制式
                    if (_strSubTypeName.equalsIgnoreCase("TD-SCDMA") || _strSubTypeName.equalsIgnoreCase("WCDMA") || _strSubTypeName.equalsIgnoreCase("CDMA2000")) {
                        strNetworkType = NETWORK_TYPE_3G;
                    } else {
                        strNetworkType = NETWORK_TYPE_UNKNOWN;
                    }

                    break;
            }

        }
    }


    return strNetworkType;
}
 
开发者ID:sundevin,项目名称:utilsLibrary,代码行数:58,代码来源:NetworkUtils.java

示例7: adjustThreadCount

void adjustThreadCount(NetworkInfo info) {
  if (info == null || !info.isConnectedOrConnecting()) {
    setThreadCount(DEFAULT_THREAD_COUNT);
    return;
  }
  switch (info.getType()) {
    case ConnectivityManager.TYPE_WIFI:
    case ConnectivityManager.TYPE_WIMAX:
    case ConnectivityManager.TYPE_ETHERNET:
      setThreadCount(4);
      break;
    case ConnectivityManager.TYPE_MOBILE:
      switch (info.getSubtype()) {
        case TelephonyManager.NETWORK_TYPE_LTE:  // 4G
        case TelephonyManager.NETWORK_TYPE_HSPAP:
        case TelephonyManager.NETWORK_TYPE_EHRPD:
          setThreadCount(3);
          break;
        case TelephonyManager.NETWORK_TYPE_UMTS: // 3G
        case TelephonyManager.NETWORK_TYPE_CDMA:
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
          setThreadCount(2);
          break;
        case TelephonyManager.NETWORK_TYPE_GPRS: // 2G
        case TelephonyManager.NETWORK_TYPE_EDGE:
          setThreadCount(1);
          break;
        default:
          setThreadCount(DEFAULT_THREAD_COUNT);
      }
      break;
    default:
      setThreadCount(DEFAULT_THREAD_COUNT);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:PicassoExecutorService.java

示例8: getNetworkType

/**
 * 获取当前网络类型
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>}</p>
 *
 * @return 网络类型
 * <ul>
 * <li>{@link NetworkType#NETWORK_WIFI   } </li>
 * <li>{@link NetworkType#NETWORK_4G     } </li>
 * <li>{@link NetworkType#NETWORK_3G     } </li>
 * <li>{@link NetworkType#NETWORK_2G     } </li>
 * <li>{@link NetworkType#NETWORK_UNKNOWN} </li>
 * <li>{@link NetworkType#NETWORK_NO     } </li>
 * </ul>
 */
public static NetworkType getNetworkType() {
    NetworkType netType = NetworkType.NETWORK_NO;
    NetworkInfo info = getActiveNetworkInfo();
    if (info != null && info.isAvailable()) {

        if (info.getType() == ConnectivityManager.TYPE_WIFI) {
            netType = NetworkType.NETWORK_WIFI;
        } else if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
            switch (info.getSubtype()) {

                case NETWORK_TYPE_GSM:
                case TelephonyManager.NETWORK_TYPE_GPRS:
                case TelephonyManager.NETWORK_TYPE_CDMA:
                case TelephonyManager.NETWORK_TYPE_EDGE:
                case TelephonyManager.NETWORK_TYPE_1xRTT:
                case TelephonyManager.NETWORK_TYPE_IDEN:
                    netType = NetworkType.NETWORK_2G;
                    break;

                case NETWORK_TYPE_TD_SCDMA:
                case TelephonyManager.NETWORK_TYPE_EVDO_A:
                case TelephonyManager.NETWORK_TYPE_UMTS:
                case TelephonyManager.NETWORK_TYPE_EVDO_0:
                case TelephonyManager.NETWORK_TYPE_HSDPA:
                case TelephonyManager.NETWORK_TYPE_HSUPA:
                case TelephonyManager.NETWORK_TYPE_HSPA:
                case TelephonyManager.NETWORK_TYPE_EVDO_B:
                case TelephonyManager.NETWORK_TYPE_EHRPD:
                case TelephonyManager.NETWORK_TYPE_HSPAP:
                    netType = NetworkType.NETWORK_3G;
                    break;

                case NETWORK_TYPE_IWLAN:
                case TelephonyManager.NETWORK_TYPE_LTE:
                    netType = NetworkType.NETWORK_4G;
                    break;
                default:

                    String subtypeName = info.getSubtypeName();
                    if (subtypeName.equalsIgnoreCase("TD-SCDMA")
                            || subtypeName.equalsIgnoreCase("WCDMA")
                            || subtypeName.equalsIgnoreCase("CDMA2000")) {
                        netType = NetworkType.NETWORK_3G;
                    } else {
                        netType = NetworkType.NETWORK_UNKNOWN;
                    }
                    break;
            }
        } else {
            netType = NetworkType.NETWORK_UNKNOWN;
        }
    }
    return netType;
}
 
开发者ID:ChunweiDu,项目名称:Utils,代码行数:68,代码来源:NetworkUtil.java

示例9: checkNetworkType

static int checkNetworkType(Context context) {

        int netType = 0;
        //连接管理对象
        ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        //获取NetworkInfo对象
        @SuppressLint("MissingPermission") NetworkInfo networkInfo = manager.getActiveNetworkInfo();
        if (networkInfo == null)
            return netType;
        switch (networkInfo.getType()) {
            case ConnectivityManager.TYPE_WIFI:
            case ConnectivityManager.TYPE_WIMAX:
            case ConnectivityManager.TYPE_ETHERNET:
                return 1;

            case ConnectivityManager.TYPE_MOBILE:
                switch (networkInfo.getSubtype()) {
                    case TelephonyManager.NETWORK_TYPE_LTE:  // 4G
                    case TelephonyManager.NETWORK_TYPE_HSPAP:
                    case TelephonyManager.NETWORK_TYPE_EHRPD:
                        return 2;
                    case TelephonyManager.NETWORK_TYPE_UMTS: // 3G
                    case TelephonyManager.NETWORK_TYPE_CDMA:
                    case TelephonyManager.NETWORK_TYPE_EVDO_0:
                    case TelephonyManager.NETWORK_TYPE_EVDO_A:
                    case TelephonyManager.NETWORK_TYPE_EVDO_B:
                        return 3;

                    case TelephonyManager.NETWORK_TYPE_GPRS: // 2G
                    case TelephonyManager.NETWORK_TYPE_EDGE:
                        return 4;

                    default:
                        return netType;
                }

            default:

                return netType;
        }

    }
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:42,代码来源:AgentWebUtils.java

示例10: 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

示例11: updateBatchSize

/**
 * Update batch size based on network type and status
 *
 * @param context the context, usually the application context
 */
public static int updateBatchSize(@Nullable final Context context) {
    if (context == null) {
        sBatchSize = 6;
        return sBatchSize;
    }

    // No network, use small batch size
    NetworkInfo info = getNetworkInfo(context);
    if (info == null || !info.isConnected()) {
        sBatchSize = 6;
        return sBatchSize;
    }

    // In WiFi, use large batch size
    if (info.getType() == ConnectivityManager.TYPE_WIFI) {
        sBatchSize = 24;
        return sBatchSize;
    }

    if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
        switch (info.getSubtype()) {
            case TelephonyManager.NETWORK_TYPE_HSDPA: // ~ 2-14 Mbps
            case TelephonyManager.NETWORK_TYPE_HSUPA: // ~ 1-23 Mbps
            case TelephonyManager.NETWORK_TYPE_EHRPD: // ~ 1-2 Mbps
            case TelephonyManager.NETWORK_TYPE_EVDO_B: // ~ 5 Mbps
            case TelephonyManager.NETWORK_TYPE_HSPAP: // ~ 10-20 Mbps
            case TelephonyManager.NETWORK_TYPE_LTE: // ~ 10+ Mbps
                sBatchSize = 24;
                break;
            case TelephonyManager.NETWORK_TYPE_EVDO_0: // ~ 400-1000 kbps
            case TelephonyManager.NETWORK_TYPE_EVDO_A: // ~ 600-1400 kbps
            case TelephonyManager.NETWORK_TYPE_HSPA: // ~ 700-1700 kbps
            case TelephonyManager.NETWORK_TYPE_UMTS: // ~ 400-7000 kbps
                sBatchSize = 12;
                break;
            case TelephonyManager.NETWORK_TYPE_IDEN: // ~25 kbps
            case TelephonyManager.NETWORK_TYPE_CDMA: // ~ 14-64 kbps
            case TelephonyManager.NETWORK_TYPE_1xRTT: // ~ 50-100 kbps
            case TelephonyManager.NETWORK_TYPE_EDGE: // ~ 50-100 kbps
            case TelephonyManager.NETWORK_TYPE_GPRS: // ~ 100 kbps
            case TelephonyManager.NETWORK_TYPE_UNKNOWN:
            default:
                sBatchSize = 6;
                break;
        }
    } else {
        // In other undetermined network, use small batch size
        sBatchSize = 6;
    }
    return sBatchSize;
}
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:56,代码来源:AbstractNetworkUtils.java

示例12: 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:newDeepLearing,项目名称:decoy,代码行数:62,代码来源:NetworkUtil.java

示例13: 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

示例14: isConnectionFast

/**
  * Check if the connection is fast
  * @param type int
  * @param subType int
  * @return boolean
  */
 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:sfilmak,项目名称:MakiLite,代码行数:54,代码来源:Connectivity.java

示例15: isNetworkConnected

/**
 * Checks network type and subtype, to determine if network is fast (in kbps)
 *
 * @param type    ConnectivityManager type
 * @param subType TelephonyManager type for mobile
 * @return true if device is connected to a fast network connection
 */
private static boolean isNetworkConnected(int type, int subType) {
    if (type == ConnectivityManager.TYPE_WIFI) return true;

    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

            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:
            default:
                return false;
        }
    }
    return false;
}
 
开发者ID:Tenor-Inc,项目名称:tenor-android-core,代码行数:64,代码来源:AbstractNetworkUtils.java


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