You can find the source code for this sample by downloading a zip of all of our samples here.
- Visual Studio 2015 Update 3
- Xamarin for Visual Studio
- Xamarin 4.2.0.719 (15694b9)
- Xamarin.Android 7.0.1.6 (5a02b03)
- Update Xamarin Nuget to v2.3.3.168
This sample is intended to show how to remotely configure an IotCore device when it is not attached to a network.
There are two parts to this:
- Client - running on an Android or Windows Phone 10 phone, this app will find your IotCore device, connect to it, and allow you to specify the required information to join a WiFi network.
- Server - running on your IotCore device, this app (foreground or background) help the Client connect your IotCore device to a desired WiFi network.
The client utilizes Xamarin Forms to create a UI app for Android and Windows Phone 10 devices.
The general communication flow between Client and Server
-
Download this sample.
-
Connect to your IotCore device using the Device Portal, open the Onboarding page, and set the SoftAP settings SSID to be something recognizable.
-
Connect to your IotCore device using SSH or PowerShell and run the following commands to enable SoftAP. If you're using PowerShell, the command will need a /f flag to run successfully.
reg add hklm\system\currentcontrolset\services\mpssvc\parameters /v IoTInboundLoopbackPolicy /t REG_DWORD /d 1 checknetisolation loopbackexempt -a -n=IoTOnboardingTask-uwp_1w720vyc4ccym checknetisolation loopbackexempt -a -n=CompanionAppServer_1w720vyc4ccym
-
Restart your device.
-
Open CompanionAppServer\CompanionAppServer.sln, select the appropriate startup project, platform and use F5 to build, deploy, and launch.
CompanionAppServer
is a Background Application
-
Connect Android phone or Windows Phone 10 to computer.
-
Open CompanionAppClient\CompanionAppClient.sln, select the appropriate startup project, platform and use F5 to build, deploy, and launch.
CompanionAppClient.Droid
and Any CPU for AndroidCompanionAppClient.UWP
and ARM for Windows Phone 10
-
On your phone, follow the flow:
- Click the
Scan for Access Points
button - Select your IotCore device's access point and click the
Connect to Access Point
button - Click the
Get Networks
button - Select the desired network, enter the network's password, and click the
Connect
button
- Click the
-
At this point, your IotCore device should be connected to your desired WiFi network. If your device is not showing up, you may need to delete the profiles in "Connectivity -> Network".
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.