本文整理汇总了Java中android.telephony.TelephonyManager.NETWORK_TYPE_EVDO_0属性的典型用法代码示例。如果您正苦于以下问题:Java TelephonyManager.NETWORK_TYPE_EVDO_0属性的具体用法?Java TelephonyManager.NETWORK_TYPE_EVDO_0怎么用?Java TelephonyManager.NETWORK_TYPE_EVDO_0使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.telephony.TelephonyManager
的用法示例。
在下文中一共展示了TelephonyManager.NETWORK_TYPE_EVDO_0属性的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;
}
示例2: getNetworkClass
/**
* 获取在Mobile网络下的网络类型. 2G,3G,4G
*
* @param context
* @return
*/
public static int getNetworkClass(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_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
return NETWORK_CLASS_2_G;
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 NETWORK_CLASS_3_G;
case 13: // TelephonyManager.NETWORK_TYPE_LTE:
return NETWORK_CLASS_4_G;
default:
return NETWORK_CLASS_UNKNOWN;
}
} else if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
return NETWORK_CLASS_WIFI;
}
}
}
return NETWORK_CLASS_UNKNOWN;
}
示例3: 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);
}
}
示例4: getNetworkType
/**
* GPRS 2G(2.5) General Packet Radia Service 114kbps
* EDGE 2G(2.75G) Enhanced Data Rate for GSM Evolution 384kbps
* UMTS 3G WCDMA 联通3G Universal Mobile Telecommunication System 完整的3G移动通信技术标准
* CDMA 2G 电信 Code Division Multiple Access 码分多址
* EVDO_0 3G (EVDO 全程 CDMA2000 1xEV-DO) Evolution - Data Only (Data Optimized) 153.6kps - 2.4mbps 属于3G
* EVDO_A 3G 1.8mbps - 3.1mbps 属于3G过渡,3.5G
* 1xRTT 2G CDMA2000 1xRTT (RTT - 无线电传输技术) 144kbps 2G的过渡,
* HSDPA 3.5G 高速下行分组接入 3.5G WCDMA High Speed Downlink Packet Access 14.4mbps
* HSUPA 3.5G High Speed Uplink Packet Access 高速上行链路分组接入 1.4 - 5.8 mbps
* HSPA 3G (分HSDPA,HSUPA) High Speed Packet Access
* IDEN 2G Integrated Dispatch Enhanced Networks 集成数字增强型网络 (属于2G,来自维基百科)
* EVDO_B 3G EV-DO Rev.B 14.7Mbps 下行 3.5G
* LTE 4G Long Term Evolution FDD-LTE 和 TDD-LTE , 3G过渡,升级版 LTE Advanced 才是4G
* EHRPD 3G CDMA2000向LTE 4G的中间产物 Evolved High Rate Packet Data HRPD的升级
* HSPAP 3G HSPAP 比 HSDPA 快些
*
* @return {@link NetWorkType}
*/
public static NetWorkType getNetworkType(Context context) {
int type = getConnectedTypeINT(context);
switch (type) {
case ConnectivityManager.TYPE_WIFI:
return NetWorkType.Wifi;
case ConnectivityManager.TYPE_MOBILE:
case ConnectivityManager.TYPE_MOBILE_DUN:
case ConnectivityManager.TYPE_MOBILE_HIPRI:
case ConnectivityManager.TYPE_MOBILE_MMS:
case ConnectivityManager.TYPE_MOBILE_SUPL:
int teleType = getTelephonyManager(context).getNetworkType();
switch (teleType) {
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 NetWorkType.Net2G;
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:
return NetWorkType.Net3G;
case TelephonyManager.NETWORK_TYPE_LTE:
return NetWorkType.Net4G;
default:
return NetWorkType.UnKnown;
}
default:
return NetWorkType.UnKnown;
}
}
示例5: getNetworkType
/**
* 获取手机连接的网络类型(2G,3G,4G)
* <p>联通的3G为UMTS或HSDPA,移动和联通的2G为GPRS或EGDE,电信的2G为CDMA,电信的3G为EVDO
*/
public static int getNetworkType(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
switch (tm.getNetworkType()) {
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 Constants.NETWORK_CLASS_2_G;
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:
return Constants.NETWORK_CLASS_3_G;
case TelephonyManager.NETWORK_TYPE_LTE:
return Constants.NETWORK_CLASS_4_G;
default:
return Constants.NETWORK_CLASS_UNKNOWN;
}
}
示例6: 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);
}
}
示例7: getNetWorkType
/**
* 获取当前的网络类型(WIFI,2G,3G,4G)
* <p>需添加权限 {@code <uses-permission android:name="android.permission
* .ACCESS_NETWORK_STATE"/>}</p>
*
* @param context 上下文
* @return 网络类型
* <ul>
* <li>{@link #NETWORK_WIFI } = 1;</li>
* <li>{@link #NETWORK_4G } = 4;</li>
* <li>{@link #NETWORK_3G } = 3;</li>
* <li>{@link #NETWORK_2G } = 2;</li>
* <li>{@link #NETWORK_UNKNOWN} = 5;</li>
* <li>{@link #NETWORK_NO } = -1;</li>
* </ul>
*/
public static int getNetWorkType(Context context) {
int netType = NETWORK_NO;
NetworkInfo info = getActiveNetworkInfo(context);
if (info != null && info.isAvailable()) {
if (info.getType() == ConnectivityManager.TYPE_WIFI) {
netType = 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 = 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 = NETWORK_3G;
break;
case NETWORK_TYPE_IWLAN:
case TelephonyManager.NETWORK_TYPE_LTE:
netType = NETWORK_4G;
break;
default:
String subtypeName = info.getSubtypeName();
if (subtypeName.equalsIgnoreCase("TD-SCDMA")
|| subtypeName.equalsIgnoreCase("WCDMA")
|| subtypeName.equalsIgnoreCase("CDMA2000")) {
netType = NETWORK_3G;
} else {
netType = NETWORK_UNKNOWN;
}
break;
}
} else {
netType = NETWORK_UNKNOWN;
}
}
return netType;
}
示例8: 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);
}
示例9: 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;
}
示例10: getNetworkType
/**
* 判断当前网络类型-1为未知网络0为没有网络连接1网络断开或关闭2为以太网3为WiFi4为2G5为3G6为4G
*/
public static int getNetworkType(Context context) {
ConnectivityManager connectMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectMgr.getActiveNetworkInfo();
if (networkInfo == null) {
/** 没有任何网络 */
return 0;
}
if (!networkInfo.isConnected()) {
/** 网络断开或关闭 */
return 1;
}
if (networkInfo.getType() == ConnectivityManager.TYPE_ETHERNET) {
/** 以太网网络 */
return 2;
} else if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
/** wifi网络,当激活时,默认情况下,所有的数据流量将使用此连接 */
return 3;
} else if (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
/** 移动数据连接,不能与连接共存,如果wifi打开,则自动关闭 */
switch (networkInfo.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:
/** 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 TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
/** 3G网络 */
case TelephonyManager.NETWORK_TYPE_LTE:
/** 4G网络 */
return 4;
}
}
/** 未知网络 */
return -1;
}
示例11: updateNetworkType
/**
* Updates the network type based upon the type and subtype returned from
* the connectivity manager. Subtype is only used for cellular signals.
*
* @param type
* @param subType
*/
private void updateNetworkType(int type, int subType) {
switch (type) {
case ConnectivityManager.TYPE_WIFI:
case ConnectivityManager.TYPE_ETHERNET:
case ConnectivityManager.TYPE_BLUETOOTH:
mIsCellularConnection = false;
mIsAtLeast3G = false;
mIsAtLeast4G = false;
break;
case ConnectivityManager.TYPE_WIMAX:
mIsCellularConnection = true;
mIsAtLeast3G = true;
mIsAtLeast4G = true;
break;
case ConnectivityManager.TYPE_MOBILE:
mIsCellularConnection = true;
switch (subType) {
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_IDEN:
mIsAtLeast3G = false;
mIsAtLeast4G = false;
break;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_UMTS:
mIsAtLeast3G = true;
mIsAtLeast4G = false;
break;
case TelephonyManager.NETWORK_TYPE_LTE: // 4G
case TelephonyManager.NETWORK_TYPE_EHRPD: // 3G ++ interop
// with 4G
case TelephonyManager.NETWORK_TYPE_HSPAP: // 3G ++ but
// marketed as
// 4G
mIsAtLeast3G = true;
mIsAtLeast4G = true;
break;
default:
mIsCellularConnection = false;
mIsAtLeast3G = false;
mIsAtLeast4G = false;
}
}
}
示例12: getNetworkTypeName
public static String getNetworkTypeName(int networkType) {
switch (networkType) {
// 2G
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_GPRS:
return "GPRS";
case TelephonyManager.NETWORK_TYPE_IDEN:
return "IDEN";
// 3G
case TelephonyManager.NETWORK_TYPE_EHRPD:
return "EHRPD";
case TelephonyManager.NETWORK_TYPE_EVDO_0:
return "EVDO_0";
case TelephonyManager.NETWORK_TYPE_EVDO_A:
return "EVDO_A";
case TelephonyManager.NETWORK_TYPE_EVDO_B:
return "EVDO_B";
case TelephonyManager.NETWORK_TYPE_HSDPA:
return "HSDPA";
case TelephonyManager.NETWORK_TYPE_HSPA:
return "HSPA";
case TelephonyManager.NETWORK_TYPE_HSPAP:
return "HSPAP";
case TelephonyManager.NETWORK_TYPE_HSUPA:
return "HSUPA";
case TelephonyManager.NETWORK_TYPE_UMTS:
return "UMTS";
case NETWORK_TYPE_TD_SCDMA:
return "TD_SCDMA";
// 4G
case TelephonyManager.NETWORK_TYPE_LTE:
return "LTE";
case NETWORK_TYPE_IWLAN:
return "IWLAN";
default:
return Integer.toString(networkType);
}
}
示例13: isFastMobileNetwork
/**
* Whether is fast mobile network
*/
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;
}
}
示例14: 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;
}
}
示例15: getCurrentConnectionSubtype
/**
* Returns the connection subtype for the given NetworkState.
*/
public int getCurrentConnectionSubtype(NetworkState networkState) {
if (!networkState.isConnected()) {
return ConnectionSubtype.SUBTYPE_NONE;
}
switch (networkState.getNetworkType()) {
case ConnectivityManager.TYPE_ETHERNET:
case ConnectivityManager.TYPE_WIFI:
case ConnectivityManager.TYPE_WIMAX:
case ConnectivityManager.TYPE_BLUETOOTH:
return ConnectionSubtype.SUBTYPE_UNKNOWN;
case ConnectivityManager.TYPE_MOBILE:
// Use information from TelephonyManager to classify the connection.
switch (networkState.getNetworkSubType()) {
case TelephonyManager.NETWORK_TYPE_GPRS:
return ConnectionSubtype.SUBTYPE_GPRS;
case TelephonyManager.NETWORK_TYPE_EDGE:
return ConnectionSubtype.SUBTYPE_EDGE;
case TelephonyManager.NETWORK_TYPE_CDMA:
return ConnectionSubtype.SUBTYPE_CDMA;
case TelephonyManager.NETWORK_TYPE_1xRTT:
return ConnectionSubtype.SUBTYPE_1XRTT;
case TelephonyManager.NETWORK_TYPE_IDEN:
return ConnectionSubtype.SUBTYPE_IDEN;
case TelephonyManager.NETWORK_TYPE_UMTS:
return ConnectionSubtype.SUBTYPE_UMTS;
case TelephonyManager.NETWORK_TYPE_EVDO_0:
return ConnectionSubtype.SUBTYPE_EVDO_REV_0;
case TelephonyManager.NETWORK_TYPE_EVDO_A:
return ConnectionSubtype.SUBTYPE_EVDO_REV_A;
case TelephonyManager.NETWORK_TYPE_HSDPA:
return ConnectionSubtype.SUBTYPE_HSDPA;
case TelephonyManager.NETWORK_TYPE_HSUPA:
return ConnectionSubtype.SUBTYPE_HSUPA;
case TelephonyManager.NETWORK_TYPE_HSPA:
return ConnectionSubtype.SUBTYPE_HSPA;
case TelephonyManager.NETWORK_TYPE_EVDO_B:
return ConnectionSubtype.SUBTYPE_EVDO_REV_B;
case TelephonyManager.NETWORK_TYPE_EHRPD:
return ConnectionSubtype.SUBTYPE_EHRPD;
case TelephonyManager.NETWORK_TYPE_HSPAP:
return ConnectionSubtype.SUBTYPE_HSPAP;
case TelephonyManager.NETWORK_TYPE_LTE:
return ConnectionSubtype.SUBTYPE_LTE;
default:
return ConnectionSubtype.SUBTYPE_UNKNOWN;
}
default:
return ConnectionSubtype.SUBTYPE_UNKNOWN;
}
}