簡體   English   中英

主動Android wifi掃描

[英]Active Android wifi scan

據我從以前的帖子中了解到,完成主動wifi掃描(startScanActive())的時間應在0.7 s左右,但在我的手機上,它與被動掃描(startScan())相同。 我也看不到隱藏的SSID,還有其他方法可以更快地獲取wifi掃描結果和隱藏的SSID嗎?

主動和被動掃描的一些背景:

主動掃描通過發送探測請求來主動掃描所有非被動通道,因此花費在每個通道上的時間很短。 被動掃描通常用於不允許進行主動掃描的DFS信道,因此設備必須等待一個信標間隔才能找到該信道上的所有AP。 整體掃描被動通道應比掃描主動通道花費更多時間

就您而言,您應該能夠在android開發人員API參考中使用以獲取掃描結果:

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()

在Android參考中, startScanActive不是公開的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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM