The procedure for setting a headed app to run at startup is virtually identical to the procedure for setting up a headless app.

In the previous section, we rebooted the Pi, and (hopefully) the LED started blinking.

Have a look at the IoT Dashboard. When the restart is complete, you should see your Pi reappear in the My devices list. From the dashboard, open the Device Portal and navigate to the Apps page. You should see BlinkyHeadless in the list of Running apps.

Since we’re going to replace BlinkyHeadless with BlinkyHeaded, find BlinkyHeadless in the list of running apps and click the X’ next to its name to stop it.

(We have to remove BlinkyHeadless because it uses the same GPIO pin as BlinkyHeaded.  You can't run two apps that access the same pin!)

Now, make sure BlinkyHeaded runs correctly from Visual Studio (at the time of this writing there was a deployment bug in Visual Studio that happened when the Pi was restarted. The workaround is to close and reopen Visual Studio after the restart is complete).

Go back to PowerShell on your Windows computer. Since you rebooted, you’ll have to reconnect PowerShell to the Pi.

Re-enter the Set_Item command (which establishes a trusted relationship between the computer and the Pi). You’ll be asked for your user name and password again. Then re-issue the Enter-PSSession command.

Both of these commands were explained in the PowerShell section of this tutorial, so refer back to that if you’ve forgotten them.

PowerShell should now be reconnected to your Pi. Enter the IoTStartup startup command to see that BlinkyHeadless is in the list of startup apps:

The next step is to remove BlinkyHeadless as a startup app, and replace it with BlinkyHeaded.

Enter the following command to remove BlinkyHeadless from the startup list

IotStartup remove headless BlinkyHeadless

And enter the following command to add BlinkyHeaded to the startup list

IotStartup add headed BlinkyHeaded

Let’s review: We stopped BlinkyHeadless, we removed BlinkyHeadless from the list of startup apps, and we added BlinkyHeaded to the list of startup apps. Enter the restart command in PowerShell.

You should already have an HDMI monitor attached to the Pi, from when you first developed BlinkyHeaded. Restart the Pi with the shutdown /r /t 0 command. When the boot completes, you should see the BlinkyHeaded GUI on the monitor, and the LED should be blinking.

Wait – what happened to the original Windows IoT Core GUI?

When you set BlinkyHeaded as the startup headed app, you replaced the default headed startup app. There can be only one headed startup app. But you can go back to the original app. It’s called IoTCoreDefaultApp, and you can set that back to be the headed startup app in PowerShell.

In this example, we issued the IoTStartup startup command to list the current startup apps. Then we issued the command IoTStartup add headed IoTCoreDefaultApp to set the headed startup app back to the default. Issuing the IoTStartup startup command again shows the change:

This guide was first published on Aug 03, 2016. It was last updated on Aug 03, 2016.

This page (Headed Apps at Startup) was last updated on Jul 20, 2016.

Text editor powered by tinymce.