Programmatically Listing and Connecting to WIFI networks on Windows IoT Core

lucidgold picture lucidgold · Feb 6, 2016 · Viewed 9.1k times · Source

Is there API that lists and allows us to connect to a specific wifi network by providing passcode via C# on Windows IoT Core?

I see that it is possible to do it when you are running an OS on the PI other than Windows IoT here via command line.

Another question was asked on creating an app to run on WinRT here, but only listing connected WIFI networks was possible. I am not sure if Windows IoT has more functionality exposed?

UPDATE #1:

I found Managed Wifi API which allows you to control Wifi (802.11) network adapters installed in your Windows machine programmatically.

Another possible solution is SimpleWifi

I will give those a try to see if I can do the same on a Raspberry Pi 2 B, then will update my question. However, if anyone can suggest better methods please do.

UPDATE #2:

I am now recieving the following error when I try to install NuGet package SimpleWifi on a Visual C# Universal Windows app:

SimpleWifi 1.0.0.0 is not compatible with UAP,Version=v10.0 (win10-arm)

I also recieve a similar error when installing NuGet package for ManagedWifi:

Some packages are not compatible with UAP,Version=v10.0 (win10-x64-aot).

Answer

Anurag Vasanwala picture Anurag Vasanwala · Feb 6, 2016

When Windows IoT boots, it start with default IoT app (if you have not modified startup applications) that is IoTCoreDefaultApp. Default application allows you to view and connect to WiFi. Microsoft has provided source code for default app. Specific to WiFi related code, I found it in this file: IoTCoreDefaultApp \ IoTCoreDefaultApp \ Views \ OOBENetwork.xaml.cs

Windows IoT > WiFi Connection Wizard

Download: Windows IoT Samples

.

Update: February 7, 2016

Microsoft has provided tutorial on how to list WiFi network and how you can connect to one. "Windows.Devices.WiFi.WiFiAdapter" provide members to manipulate WiFi in UWP programmatically. Refer WiFi Connect Sample.