List of usage examples for android.net ConnectivityManager TYPE_MOBILE
int TYPE_MOBILE
To view the source code for android.net ConnectivityManager TYPE_MOBILE.
Click Source Link
From source file:com.codename1.impl.android.AndroidImplementation.java
/** * @inheritDoc/*w w w .java2 s .com*/ */ public int getAPType(String id) { if (apIds == null) { getAPIds(); } NetworkInfo info = (NetworkInfo) apIds.get(id); if (info == null) { return NetworkManager.ACCESS_POINT_TYPE_UNKNOWN; } int type = info.getType(); int subType = info.getSubtype(); if (type == ConnectivityManager.TYPE_WIFI) { return NetworkManager.ACCESS_POINT_TYPE_WLAN; } else if (type == ConnectivityManager.TYPE_MOBILE) { switch (subType) { case TelephonyManager.NETWORK_TYPE_1xRTT: return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; // ~ 50-100 kbps case TelephonyManager.NETWORK_TYPE_CDMA: return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; // ~ 14-64 kbps case TelephonyManager.NETWORK_TYPE_EDGE: return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; // ~ 50-100 kbps case TelephonyManager.NETWORK_TYPE_EVDO_0: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 400-1000 kbps case TelephonyManager.NETWORK_TYPE_EVDO_A: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 600-1400 kbps case TelephonyManager.NETWORK_TYPE_GPRS: return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; // ~ 100 kbps case TelephonyManager.NETWORK_TYPE_HSDPA: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 2-14 Mbps case TelephonyManager.NETWORK_TYPE_HSPA: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 700-1700 kbps case TelephonyManager.NETWORK_TYPE_HSUPA: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 1-23 Mbps case TelephonyManager.NETWORK_TYPE_UMTS: return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 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 NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 1-2 Mbps case TelephonyManager.NETWORK_TYPE_EVDO_B: // API level 9 return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 5 Mbps case TelephonyManager.NETWORK_TYPE_HSPAP: // API level 13 return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 10-20 Mbps case TelephonyManager.NETWORK_TYPE_IDEN: // API level 8 return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; // ~25 kbps case TelephonyManager.NETWORK_TYPE_LTE: // API level 11 return NetworkManager.ACCESS_POINT_TYPE_NETWORK3G; // ~ 10+ Mbps // Unknown case TelephonyManager.NETWORK_TYPE_UNKNOWN: default: return NetworkManager.ACCESS_POINT_TYPE_NETWORK2G; } } else { return NetworkManager.ACCESS_POINT_TYPE_UNKNOWN; } }