获取可用 WiFi 点列表
我正在创建一个需要互联网连接的应用程序。因此,当 WiFi 设置未启用时,我会弹出一条消息来将其打开。但当它打开时,它不一定连接到 WiFi 接入点。
有什么办法可以在列表中显示当前所有可用的 WiFi 点吗?
提前致谢
I'm creating an app that needs internet connection. So when the WiFi setting is not enabled, I pop up a message to switch it on. But when it's on, it's not nessecarily connected to a WiFi Access Point.
Is there any way to show all current available WiFi spots in a list?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看
WifiManager
类的方法。特别是getScanResults()
方法将返回上次扫描 Wifi 网络的结果。请注意,getConfiguredNetworks()
仅返回用户事先配置的网络(即已为安全网络提供密码等)。Have a look on the methods of the
WifiManager
class. Especially thegetScanResults()
method will return the results of the last scan for Wifi networks. Be aware that thegetConfiguredNetworks()
only returns those networks that have been configured beforehand by the user (i.e. the password has been provided for a secured network, etc).http://developer.android.com/reference/android/net /wifi/WifiManager.html#startScan()
http://developer.android.com/reference/android/net/wifi/WifiManager.html#startScan()