如何在Android中检查特定设备是否支持4G网络?
我想检查特定设备是否具有对 4G 网络的硬件支持。
我将详细说明这个问题...
在应用程序中,我们有一个设置页面,用户可以在其中进行选择并允许应用程序仅在选定的网络中运行。 例如。用户可以选择该应用程序仅在 WiFi 网络或仅在 3G 网络等中运行。
所有网络 WiFi、2G、3G 4G 等都有复选框首选项。 现在,如果设备不支持 4G 网络,我想隐藏 4G 选择复选框。
其余所有功能均已完成。我对这个问题感到震惊,如何检测设备是否支持 4G?
请注意,我想检测设备上对 4G 的硬件支持,而不是 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用这段代码并获取设备上的所有可用选项。我认为您应该能够获得该设备的所有功能。
网络类型信息存在于 http://developer.android.com/reference/ android/telephony/TelephonyManager.html。
我认为从 API 级别 11 添加的网络类型适用于 4g。你自己检查一下。
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.
这可能有效。它应该检查 WiMax 4g:
尝试查看此再多一点澄清。
This might work. It should check for WiMax 4g:
Try looking at this for a little more clarification.
检查 isNetAvailable 的值在所有 3 种情况下是否正确,这对我有用,希望对你也有用。
注意:4G 可用性将从 API 级别 8 开始引入。
Check for value of isNetAvailable is true in all the 3 cases this works for me, wish work for u too
Note : 4G availability will be introduces API level 8 onwards.