How to get the current connection wifi channel (frequency) in iOS?

前提是你 提交于 2021-02-18 18:14:50

问题


I want to know how to get WIFI channel and frequency information in iOS.

It would be better not to get from the private APIs (because I need to submit it to the iTunes Store).


回答1:


There's no way to do this using publicly available APIs, as of iOS 7. The OS algorithm controls networking and decides which channel to use based on congestion, interference, and other factors.

If you're okay with using private APIs, then you can use Stumbler, a library that exposes the data you're interested in: https://code.google.com/p/iphone-wireless/wiki/Stumbler

Warning: If you want to use private APIs, then you won't be able to distribute through the App Store (and you'll have all the other hazards that come with using Apple's private API: the banhammer, breakage at any time, et cetera).




回答2:


As others noted there is no way to get wi-fi frequency on iOS using official APIs.

There is one work-around to determine whether user is connected to 2.4Ghz or 5Ghz range by actively running a wifi measurement. You can set a limit which will not be realistic on 2.4Ghz (e.g. typically speeds over 100 Mbit on wi-fi are not achievable on 2.4 Ghz).

To run wi-fi measurement its better to run true wi-fi speed measurement and not internet speed measurement as the latter can be slowed down by the ISP (and not the wi-fi).

Here is relevant Stackoverflow comment how to measure wi-fi speed - iOS Get Link Speed (Router Speed Test)

In either way you will not be able to determine actual wifi channel, only whether its 2.4 or 5Ghz. This can be further complicated in the future with 6Ghz ranges where it will not be that easy to split between 5 and 6 Ghz.



来源:https://stackoverflow.com/questions/20462324/how-to-get-the-current-connection-wifi-channel-frequency-in-ios

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