Android examples for Network:Network Connection
is China Telecom 3G Network Connection
//package com.java2s; import android.annotation.TargetApi; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Build; import android.telephony.TelephonyManager; public class Main { public static final int NETWORK_TYPE_NO_CONNECTION = -1231545315; public static boolean isChinaTelecom3G(Context context) { return isEVDO_0BySubtype(context) || isEVDO_ABySubtype(context) || isEVDO_BBySubtype(context); }/*from www .j av a 2 s . co m*/ public static boolean isEVDO_0BySubtype(Context context) { return getCurrentNetworkSubtype(context) == TelephonyManager.NETWORK_TYPE_EVDO_0; } public static boolean isEVDO_ABySubtype(Context context) { return getCurrentNetworkSubtype(context) == TelephonyManager.NETWORK_TYPE_EVDO_A; } @TargetApi(Build.VERSION_CODES.GINGERBREAD) public static boolean isEVDO_BBySubtype(Context context) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) { return false; } else { return getCurrentNetworkSubtype(context) == TelephonyManager.NETWORK_TYPE_EVDO_B; } } public static int getCurrentNetworkSubtype(Context context) { NetworkInfo networkInfo = ((ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE)) .getActiveNetworkInfo(); return networkInfo != null ? networkInfo.getSubtype() : NETWORK_TYPE_NO_CONNECTION; } }