I am learning Android development to my own and wandering to know if my device has the hardware that can support the LTE network.
I am trying the below, but I think it is giving me wrong data
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] info = cm.getAllNetworkInfo();
for(int i=0; i <info.length; i++){
Log.i("netinfo"+i, info[i].getType()+"");
Log.i("netinfo"+i, info[i].getTypeName());
Log.i("netinfo"+i, info[i].getSubtype()+"");
Log.i("netinfo"+i, info[i].getSubtypeName());
So in short I just want to know if my device supports LTE data network or only 3g or 4g networks.
Thanks in Advance
I'd go with:
int TelephonyManager.getDataNetworkType()
compare the value with the (defined) constants:
NETWORK_TYPE_UNKNOWN, NETWORK_TYPE_GPRS, NETWORK_TYPE_EDGE,
NETWORK_TYPE_UMTS, NETWORK_TYPE_CDMA, NETWORK_TYPE_EVDO_0,
NETWORK_TYPE_EVDO_A, NETWORK_TYPE_1xRTT, NETWORK_TYPE_HSDPA,
NETWORK_TYPE_HSUPA, NETWORK_TYPE_HSPA, NETWORK_TYPE_IDEN,
NETWORK_TYPE_EVDO_B, NETWORK_TYPE_LTE, NETWORK_TYPE_EHRPD,
NETWORK_TYPE_HSPAP, NETWORK_TYPE_GSM, NETWORK_TYPE_TD_SCDMA,
NETWORK_TYPE_IWLAN, or NETWORK_TYPE_NR
NETWORK_TYPE_GSM is 2G
NETWORK_TYPE_GPRS, NETWORK_TYPE_EDGE is 2,5G
NETWORK_TYPE_UMTS is 3G
NETWORK_TYPE_HSDPA, NETWORK_TYPE_HSUPA, NETWORK_TYPE_HSPA, NETWORK_TYPE_HSPAP are 3,5G
NETWORK_TYPE_LTE is 4G
NETWORK_TYPE_NR is 5G
This is the API reference
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.