How can I get RSSI value from wifi network in swift? [closed]
Asked Answered
U

1

6

How can I get the RSSI (received signal strength indication) value of the WiFi network the mobile device is connected to, in Swift Code

Ultramicroscope answered 30/7, 2013 at 7:28 Comment(0)
E
3

TL;DR

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.

Detailed Version

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:

  • some APIs are not there yet so they're there just for Apple's own internal development & testing,
  • Apple doesn't want some aspects of iOS to be abused and be developed maturely as time progresses(e.g. the camera APIs to manipulate the aspects of photograph taking),
  • and of course, Apple has a money-making agenda that they utilise those APIs according to their needs.

What to do

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:

  • First off, on iOS, certain frameworks require certain entitlements. Therefore, when you find the necessary private framework for the APIs you want, you also need to figure out it's entitlement(s) and inject it into your project. Which is/are not readily available,
  • Integrating private frameworks into a project is not as straightforward as integrating a public framework, say CoreLocation, since they're not documented and you will be walking blind with your guts,
  • Once you integrate a private framework, it's usage will be difficult as well both because of the above reasons and the possibility of Apple making changes to those private APIs. Of course, every API changes from time to time but Apple can break things apart as it wishes with private APIs since it never allowed you to use them in the first place. So, something you've spent long hours on could be for nothing in the future.

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!

Electromotive answered 11/5, 2018 at 19:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.