iosswiftcaptivenetworknetworkextension

How get a list of networks SSIDs, which is able for Device in search moment?


I need to get list of able networks with its parameters(ex. SSID), using NetworkExtensions. Now, I'm in process for getting access to NetworkExtensions library, that's need some time after request.

If someone has already existed code, maybe some personal-written func and can shared that's code with me and other forum users - do it:)

UPD: There's in answers some good ideas and linking for kNEHotspotHelperCommandTypeFilterForScan, but I really don't know how use it.


Solution

  • Looks like, you cannot simply access that info using Captive network Api's. You can get the details of the wifi your device is currently connected to using CNCopyCurrentNetworkInfo

    you can get ssid details using NEHotspotHelper in Network Extension, but you need to get access from Apple before using NEHotspotHelper.

    Using NEHotspotHelperCommandType => FilterScanList(Filter the Wi-Fi scan list) and Evaluate(Evaluate the network). you can get all available NEHotspotNetwork(whcih will contain ssid, bssid, and signalStrength) after registeration is successful

    Reference : https://stackoverflow.com/a/39189063/1741121