Get list of available WiFi networks

Good morning,

So let me explain what I’m needing. We have a IoT device, that we have no way of changing. This device has the ability to be put into a broadcast mode which turns the device into a Wifi Router that we connect to. Once we are connected to the device, we then have the ability to set that device up to connect to a customers WiFi network.

What I’m wanting to do is this:

1: User will physically put the device in broadcast mode 2: Mobile app will then scan all available local wifi’s looking for a SSID that matches the a MAC Address 3: The mobile app will then need to connect the device to the consumer's WiFi.

#2 is where the problem lies. I need to get a list of wifi networks local to the mobile device so I can pick out the MAC address that I need to connect to.

Any examples of this working would be awesome. The application I'm writing is written in Xamarin but even if you were to provide swift examples, I should be able to convert it.

Thanks,

BTW, it’s preferable to continue the conversation via a thread reply rather than a comment; see tip 5 here.

Apple won't approve the Hotspot helper.

Right, since it sounds like you are making an accessory rather than a hotspot for accessing the Internet. So you would fall under the Add an accessory to the user’s network case, which basically amounts to the Temporarily join a network case since you’re not doing WAC or HomeKit. These cases don’t require the entitlement.

Mobile app will then scan all available local wifi’s looking for a SSID that matches the a MAC Address

Do you mean the SSID is the stringified version of the MAC address? And do you know it in advance, such as from scanning a QR code on the accessory? If so, then you can use NEHotspotConfigurationManager to connect to that known SSID. Or if the SSID has at least a known prefix (e.g. AcmeAccessory_) then you can use that.

@Scott, as of right now we wouldn't know the SSID value from a QR Code on the accessory. I was hoping to be able to scan the area for local networks, and then iterate the list looking for a SSID that looks like a MAC address. This typically would be the device we are looking to connect to. I saw the NEHotspotConfigurationManager, but that would require the SSID of the network you're attempting to connect to. Was hoping to get a list of those networks.

Hmm, sounds like there aren’t great options for solving this.

Is the MAC address at least printed somewhere on the accessory? One not-so-great idea would be to have the user “scan” the accessory’s printed MAC address for you using their eyeballs and fingers. The doc for NEHotspotConfiguration(ssidPrefix:) says the prefix must be 3 characters minimum, so you could get by with having them enter only the first 3 characters, or even just the first 2 if you know that the 3rd is (for example) always : or -.

Or you could even try to scan a printed MAC address using the Vision framework. I’ve never used it but it sounds cool.

Get list of available WiFi networks
 
 
Q