How to check whether a particular device supports 4G networks in Android?

Udayan picture Udayan · Oct 25, 2011 · Viewed 21.7k times · Source

I want to check if a particular device has hardware support for 4G networks.

I will elaborate the issue...
In the application we have a settings page where user can make selection and allow application to run only in selected networks. Eg. User can select that app will run only in WiFi network or only in 3G network etc.

There are CheckBox preferences for all networks WiFi, 2G, 3G 4G etc. Now if the device doesn't have the support for 4G network, I want to hide the 4G selection checkbox.
All the remaining functionality is complete. I am struck on just this issue that how to detect if device support 4G or not?
Please note that I want to detect hardware support for 4G on the device and NOT the 4G connection is connected or so.
Any help is greatly appreciated.

Answer

user550925 picture user550925 · Nov 1, 2011
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());
   }

Use this piece of code and get all available options on the device. I think you should be able to get all capabilities of the device.

and network type info is present in http://developer.android.com/reference/android/telephony/TelephonyManager.html.

I think network types added from API level 11 are for 4g. Check it yourself.