问题描述
我如何知道设备是否以编程方式连接到 Wifi 或 3G
How i can know device is connected to Wifi or 3G, programmatically
谢谢
推荐答案
你可以使用上面提到的 WifiManager 类 这里
you can use WifiManager class as mentioned here
通过调用 WifiManager 类的 getConnectionInfo() 函数,您将获得 WifiInfo 对象
by calling getConnectionInfo() function of WifiManager class you will get WifiInfo object
WifiInfo 具有 getBSSID() 函数,可以为您提供连接的 AP 名称
WifiInfo has function getBSSID() which gives you connected AP's name
如果它为空,则表示它没有通过 Wifi 连接到任何 AP(未启用 Wifi)
if its null that means it is not connected to any AP via Wifi ( Wifi is not enabled )
顺便说一句,在寻找更多信息时,我发现 this 应该回答您关于移动连接和 wifi 连接的所有问题
btw while looking for more info, i found this which should answer all your questions about mobile connectivity and wifi connectivity
这篇关于如何以编程方式知道设备已连接到 Wifi 或 3G的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)