Android, wifi active scans

冷暖自知 提交于 2019-12-19 10:45:42

问题


I need a frequent wifi scan on my android application (I'm trying to build a local indoor positioning system based on wifi RSSI values). IF I call wifi.startScan() I have onReceive() called back once every 6 seconds (I suppose by default it's scanning passively): how do I get more frequent callbacks? Should I ask for "active" scans? How is it done? Are there any drawbacks?


回答1:


I don't think you can. It is a device and/or OS version dependend setting. On the Nexus One for example it takes roughly a second to scan whereas on the G1 it takes significantly longer (or get fresh results after a few scans). If I recall correctly, some Android Version (< 2.0) did not issue a fresh scan everytime startScan() was called but might have reused the old result. But I might be mistaken on that one.




回答2:


I've been trying the same thing and I came to the following conclusion. It's not possible on 2.1 and higher. I've got no clue on lower versions because my app had to run on 2.1 and higher.

-Changed stuff inside the Android SDK so it will enable active scanning

-Traced it back to the driver resulting in the following conclusion: The driver will set the wifi module in passive mode every time. I've been looking to change this inside the driver but there was no setting inside the drive to achieve this.

Bottom line: Not possible.



来源:https://stackoverflow.com/questions/5880453/android-wifi-active-scans

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!