How can I get the RSSI (received signal strength indication) value of the WiFi network the mobile device is connected to, in Swift Code
It's definitely not something to achieve on a production app going to the AppStore but you may be able to achieve something as a proof-of-concept for yourself using private APIs.
On iOS, there are APIs for reading RSSI
values of nearby Wi-Fi networks and other such operations but most unfortunately, they're not publicly available.
Apple makes a distinction as public and private APIs. The ones that developers can use(the public ones) and ship apps with to the AppStore are documented at developer.apple.com.
The other APIs(private ones) are not publicly documented by Apple. The reason for doing so mostly boils down to Apple wanting to control every aspect of iOS but in a more comprehensive manner:
The above being said, private APIs are still reachable if you know what you're doing.
The basic idea is that, since both public and private APIs are being used in iOS(either by general developers or Apple), they all should be in the runtime
. All you need is a tool to fish them out. And this tool is RunTimeBrowser. The maintainer of this project, Nicolas Seriot, also publishes his findings here as a GitHub repo as well.
If you check out these findings, you'll be able to find the appropriate APIs for retrieving the RSSI
values of nearby Wi-Fi networks.
However, I should forward warn you that this is not as easy as it sounds. Once you find the appropriate APIs, it just doesn't end there:
CoreLocation
, since they're not documented and you will be walking blind with your guts,With all that being said as a warning(I really don't want to discourage you but you should see where you're headed), there is still work being done about private APIs either for personal usage or other reasons.
You can checkout BeeTee by Michael Dorner where he demonstrates how to use BluetoothManager
, a private framework for controlling Bluetooth on iOS.
Learning from that project, you can apply that knowledge to reading RSSI
values of nearby Wi-Fi networks. Just remember that there is no way you can get it approved on the AppStore.
Have fun!