如何检查特定设备是否支持4G网络的Andr​​oid中? [英] How to check whether a particular device supports 4G networks in Android?

查看:134
本文介绍了如何检查特定设备是否支持4G网络的Andr​​oid中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要检查特定设备具有4G网络的硬件支持。

我会阐述这个问题...
在应用方面,我们有一个设置页面,用户可以进行选择,并允许应用程序在选定的网络上运行。 例如。用户可以选择该应用程序将仅在WiFi网络或仅在3G网络等。

运行

有所有网络的WiFi复选框preferences,2G,3G 4G等。 现在,如果设备没有4G网络的支持,我想隐藏的4G选择复选框。
其余所有的功能上相当完整。我打在刚才这个问题是如何检测,如果设备支持4G或不?
请注意,我要检测的硬件支持4G 在设备上,不连接的4G连接左右。照片 任何帮助是极大的AP preciated。

解决方案

  ConnectivityManager厘米=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
   的NetworkInfo []信息= cm.getAllNetworkInfo();
   的for(int i = 0; I< info.length;我++){
       Log.i(NetInfo的+ I,资讯[I] .getType()+);
       Log.i(NetInfo的+ I,信息[I] .getTypeName());
       Log.i(NetInfo的+ I,资讯[I] .getSubtype()+);
       Log.i(NetInfo的+ I,信息[I] .getSubtypeName());
   }
 

使用这块code和获取设备上的所有可用的选项。我想你应该能够获得该设备的所有功能。

和网络类型的信息是present中的http://developer.android.com/reference/android/telephony/TelephonyManager.html.

我觉得从API级别11添加的网络类型是针对4G。检查一下你自己。

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.

解决方案

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.

这篇关于如何检查特定设备是否支持4G网络的Andr​​oid中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆