How to get all the available WiFi networks list in iOS

Priya Baghel 1 Reputation point
2023-04-11T20:03:05.0766667+00:00

How to get all the available WiFi networks list in iOS.want to show list via dependency service.

Developer technologies .NET Xamarin
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,436 Reputation points Microsoft External Staff
    2023-04-12T09:36:27.04+00:00

    Hello,
    iOS does not have a general-purpose API for Wi-Fi scanning and configuration. However, it does support a wide range of special-purpose Wi-Fi APIs. Please see TN3111: iOS Wi-Fi API overview | Apple Developer Documentation So, you can try NEHotspotHelper API and the following code:

    using NetworkExtension;
    [assembly:Dependency(typeof(GetWifiListService))]
    namespace WifiListXamarinSample.iOS
    {
        public class GetWifiListService :IGetWifiListService
        {
            public GetWifiListService()
            {
            }
    
            public void GetWifiList()
            {
                var queue = new DispatchQueue("com.XXX.HotspotHelper");
                NEHotspotHelper.Register(null, queue, (cmd) =>
                {
                    if (cmd.CommandType == NEHotspotHelperCommandType.FilterScanList)
                    {
                        foreach (NEHotspotNetwork network in cmd.NetworkList)
                        {
                            Console.WriteLine(@"network.SSID = %@", network.Ssid);//you can try to return the network 
                        }
                    }
                });
            }
        }
    }
    

    But I have to say, as noted at Appl's Doc, NEHotspotHelper is only useful for hotspot integration. Before using NEHotspotHelper, you must first be granted a special entitlement (com.apple.developer.networking.HotspotHelper) and send Hotspot Helper Request to Apple.
    Best Regards, Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.