Building on my previous articles (Windows 10 IoT Core: Starting a Package on Raspberry Pi and Windows 10 IoT Core: Getting the MAC Address from Raspberry Pi) the following shows how to stop a running package.
We start with the function StopApp(), which can be called either of the following ways:
StopApp("PushButton", true); StopApp("PushButton", false);
private async void StopApp(string appName, bool Force) { String FullName = await GetPackageFullName(appName); byte toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(FullName); string appName64 = System.Convert.ToBase64String(toEncodeAsBytes);
String URL = "http://localhost:8080/api/taskmanager/stop?" + (Force ? "?forcestop=true&" : "") + "package=" + appName64;
System.Diagnostics.Debug.WriteLine(URL);
StreamReader SR = await PostJsonStreamData(URL); }
To stop the package we need the full name of the package, so let’s look it up by calling GetPackageFullName()
private async Task<String> GetPackageFullName(String PackageName) { return await GetPackageNamedName(PackageName, "PackageFullName"); }
The code for GetPackageNamedName() can be found in Windows 10 IoT Core: Starting a Package on Raspberry Pi.
And now call PostJsonStreamData() which can also be found in Windows 10 IoT Core: Starting a Package on Raspberry Pi.
Copyright © 2015 – Bruce Eitman and Embedded101.com All Rights Reserved
Re: Windows 10 IoT Core: Shutdown and Reboot the Raspberry Pi
Bruce, I noticed that you are sending a REST web request for controlling the pi. I looked online a for...
-- Waleed Elmandouh
Re: Windows 10 IoT Core: Getting the MAC Address from Raspberry Pi
Hi. This no longer works for me in the iot-core custom OEM-build/FFU. They have changed the access levels...
-- GG
Hi, since I am having trouble with this intervace in an OEM-custom Image/FFU scenario, I wonder, how...
I like your project here, and I've used it, and at one time it worked, at least with an older version...
-- integral
Nifty, Bruce!
-- David Jones
Hi Bruce, Good to know you are playing with Windows 10 IoT, and thanks for sharing these great finding...
-- Samuel Phung