首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >活动的Android wifi扫描

活动的Android wifi扫描
EN

Stack Overflow用户
提问于 2013-06-09 16:13:50
回答 1查看 872关注 0票数 0

据我从之前的帖子中了解,完成主动wifi扫描(startScanActive())的时间应该是0.7s左右,但在我的手机上,它仍然与被动扫描(startScan ())相同。我也看不到隐藏的SSIDs.Is,有没有其他方法可以更快地获得wifi扫描结果和隐藏的SSID?

EN

回答 1

Stack Overflow用户

发布于 2018-08-01 05:35:10

有关主动和被动扫描的一些背景知识:

主动扫描通过发送探测请求主动扫描所有非被动通道,因此在每个通道上花费的时间较短。被动扫描通常用于不允许主动扫描的DFS信道,因此设备必须等待一个信标间隔才能找到该信道上的所有a。整体扫描被动通道应该比扫描主动通道花费更多的时间

在您的示例中,您应该能够在android开发人员API参考中使用来获取扫描结果:

代码语言:javascript
复制
Request a scan for access points. Returns immediately. The availability of the 
results is made known later by means of an asynchronous event sent on 
completion of the scan.

To initiate a Wi-Fi scan, declare the Manifest.permission.CHANGE_WIFI_STATE 
permission in the manifest, and perform these steps:

Invoke the following method: ((WifiManager) 
getSystemService(WIFI_SERVICE)).startScan()
Register a BroadcastReceiver to listen to SCAN_RESULTS_AVAILABLE_ACTION.
When a broadcast is received, call: ((WifiManager) 
getSystemService(WIFI_SERVICE)).getScanResults()

startScanActive不是android参考中公开的API。我建议不要使用它。如果您必须使用它,请参阅以下内容- https://github.com/mozilla/MozStumbler/issues/40

参考文献:

https://developer.android.com/reference/android/net/wifi/WifiManager#startScan() https://developer.android.com/reference/android/net/wifi/WifiManager#getScanResults() https://github.com/mozilla/MozStumbler/issues/40

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17007736

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档