Installation​Manager Installation​Manager Installation​Manager Class

Definition

Manages the application installations for a phone.

public static class InstallationManagerpublic static class InstallationManagerPublic Static Class InstallationManager
Attributes
Windows 10 requirements
Device family
Windows Mobile Extension SDK (introduced v10.0.10240.0)
API contract
Windows.Phone.PhoneContract (introduced v1)

Remarks

Use this class to find applications from a particular app publisher, install apps and get pending app installs.

Methods

AddPackageAsync(String, Uri) AddPackageAsync(String, Uri) AddPackageAsync(String, Uri)

Starts the installation process for the app specified by the app title and location URI.

public static IAsyncOperationWithProgress<PackageInstallResult, uint> AddPackageAsync(String title, Uri sourceLocation)public static IAsyncOperationWithProgress<PackageInstallResult, uint> AddPackageAsync(String title, Uri sourceLocation)Public Static Function AddPackageAsync(title As String, sourceLocation As Uri) As IAsyncOperationWithProgress( Of PackageInstallResult, uint )
Parameters
title
System.String System.String System.String

The name of the app to install.

sourceLocation
Uri Uri Uri

The URI location of the app to install.

Returns

The asynchronous operation that represents the installation process.

Attributes

Remarks

Examples

void InstallMyCoolApp()
{
    Uri uri = new Uri(@"https://PlaceHolderServerName/XAP/MyCoolApp.xap");
    string appTitle = "Cool App";

    Windows.Foundation.IAsyncOperationWithProgress<PackageInstallResult, uint> result;

    // Queue up an installation request.
    result = InstallationManager.AddPackageAsync(appTitle, uri);

    // Note: You could save "result" as a member variable to enable 
    // the installation to be cancelled later.
}

AddPackageAsync(String, Uri, String, String, Uri) AddPackageAsync(String, Uri, String, String, Uri) AddPackageAsync(String, Uri, String, String, Uri)

This API is not intended to be used directly from your code.

public static IAsyncOperationWithProgress<PackageInstallResult, uint> AddPackageAsync(String title, Uri sourceLocation, String instanceId, String offerId, Uri license)public static IAsyncOperationWithProgress<PackageInstallResult, uint> AddPackageAsync(String title, Uri sourceLocation, String instanceId, String offerId, Uri license)Public Static Function AddPackageAsync(title As String, sourceLocation As Uri, instanceId As String, offerId As String, license As Uri) As IAsyncOperationWithProgress( Of PackageInstallResult, uint )
Parameters
title
System.String System.String System.String

This API is not intended to be used directly from your code.

sourceLocation
Uri Uri Uri

This API is not intended to be used directly from your code.

instanceId
System.String System.String System.String

This API is not intended to be used directly from your code.

offerId
System.String System.String System.String

This API is not intended to be used directly from your code.

license
Uri Uri Uri

This API is not intended to be used directly from your code.

Returns

This API is not intended to be used directly from your code.

Attributes

FindPackages() FindPackages() FindPackages()

Retrieves information about all packages installed across all users.

public static IIterable<Package> FindPackages()public static IIterable<Package> FindPackages()Public Static Function FindPackages() As IIterable( Of Package )
Returns

If the method succeeds, an enumerable collection of package objects is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location.

Attributes

Remarks

This method requires the ID_CAP_OEM_DEPLOYMENT capability and is not intended to be used directly from your code.

FindPackages(String, String) FindPackages(String, String) FindPackages(String, String)

Finds all installed packages with the specified name and publisher.

public static IIterable<Package> FindPackages(String packageName, String packagePublisher)public static IIterable<Package> FindPackages(String packageName, String packagePublisher)Public Static Function FindPackages(packageName As String, packagePublisher As String) As IIterable( Of Package )
Parameters
packageName
System.String System.String System.String

The package name. This parameter cannot be null.

packagePublisher
System.String System.String System.String

The package publisher. This parameter cannot be null.

Returns

If the method succeeds, an enumerable collection of package objects with the same package name and publisher name is returned. Each Package object in this collection contains information about the package, including but not limited to its name, publisher, version, and install location. If no packages with the specified name and publisher are found, this method returns an empty list.

Attributes

FindPackagesForCurrentPublisher() FindPackagesForCurrentPublisher() FindPackagesForCurrentPublisher()

Returns all the app packages with the same publisher ID as the app calling this method.

public static IIterable<Package> FindPackagesForCurrentPublisher()public static IIterable<Package> FindPackagesForCurrentPublisher()Public Static Function FindPackagesForCurrentPublisher() As IIterable( Of Package )
Returns

A list of app packages with the same publisher ID as the app calling this method.

Attributes

Remarks

This method returns all applications associated with the publisher ID of the calling app. This includes:

  • Apps preloaded on the phone.
  • Apps installed by the user.
  • Apps currently stored on the phone's SD card.
  • Enterprise apps.

Examples

using Windows.ApplicationModel;
using Windows.Phone.Management.Deployment;

void DisplayApplicationInfo(string ProductId)
{

    IEnumerable<Package> packages = InstallationManager.FindPackagesForCurrentPublisher();

    // Loop over all installed applications looking for the specified ProductId 
    // (not the most efficient way to search, but a simple way to show how to use   
    // the functionality. 
    foreach (Package package in packages)
    {
        if (package.Id.ProductId.ToString().ToLower()== ProductId.ToLower())
        {
            // Dislay the title info in the ApplicationTitle textlock.
            ApplicationTitle.Text = package.Id.Name;

            // Retrieve the icon image by getting its DSS Token.
            string token = package.GetThumbnailToken();

            // Do something with image token.

        }
    }
}

You can also use this method to see if other apps from your publisher ID are installed on a phone. If they’re installed, you can launch them. To demonstrate, the following example enumerates all apps for the current publisher ID and launches the first app in the enumeration (unless that app happens to be the current app).

IEnumerable<Package> apps = Windows.Phone.Management.Deployment.InstallationManager.FindPackagesForCurrentPublisher();
apps.First().Launch(string.Empty);

GetPendingPackageInstalls() GetPendingPackageInstalls() GetPendingPackageInstalls()

Returns all of the app installations currently in progress.

public static IIterable<IAsyncOperationWithProgress<PackageInstallResult, uint>> GetPendingPackageInstalls()public static IIterable<IAsyncOperationWithProgress<PackageInstallResult, uint>> GetPendingPackageInstalls()Public Static Function GetPendingPackageInstalls() As IIterable( Of IAsyncOperationWithProgressPackageInstallResult, uint )
Returns

A list of the app installations currently in progress. The list contains the PackageInstallResult (pending) for each installation, which are wrapped by the async operation class (IAsyncOperationWithProgress ). See Asynchronous programming for more info on how to get progress info.

Attributes

RegisterPackageAsync(Uri, IIterable<Uri>, DeploymentOptions) RegisterPackageAsync(Uri, IIterable<Uri>, DeploymentOptions) RegisterPackageAsync(Uri, IIterable<Uri>, DeploymentOptions)

Registers a package (the main package) and its dependency packages for the current user.

public static IAsyncOperationWithProgress<PackageInstallResult, uint> RegisterPackageAsync(Uri manifestUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)public static IAsyncOperationWithProgress<PackageInstallResult, uint> RegisterPackageAsync(Uri manifestUri, IIterable<Uri> dependencyPackageUris, DeploymentOptions deploymentOptions)Public Static Function RegisterPackageAsync(manifestUri As Uri, dependencyPackageUris As IIterable<Uri>, deploymentOptions As DeploymentOptions) As IAsyncOperationWithProgress( Of PackageInstallResult, uint )
Parameters
manifestUri
Uri Uri Uri

The path to the package manifest of the main package.

dependencyPackageUris

The paths to the dependency packages. If there are no dependency packages or if the dependency packages are already registered, this parameter can be null. When DeploymentOptions is set to DevelopmentMode, leave this parameter null.

deploymentOptions
DeploymentOptions DeploymentOptions DeploymentOptions

Options that modify the deployment operation.

Returns

An object that represents the asynchronous deployment operation and includes progress updates.

Attributes

RemovePackageAsync(String, RemovalOptions) RemovePackageAsync(String, RemovalOptions) RemovePackageAsync(String, RemovalOptions)

Removes a package for the current user asynchronously and receives progress and status messages on the removal operation. Dependency packages are also removed for the user if no other packages installed for the user depend on them.

public static IAsyncOperationWithProgress<PackageInstallResult, uint> RemovePackageAsync(String packageFullName, RemovalOptions removalOptions)public static IAsyncOperationWithProgress<PackageInstallResult, uint> RemovePackageAsync(String packageFullName, RemovalOptions removalOptions)Public Static Function RemovePackageAsync(packageFullName As String, removalOptions As RemovalOptions) As IAsyncOperationWithProgress( Of PackageInstallResult, uint )
Parameters
packageFullName
System.String System.String System.String

A string representation of the package identity to identify the package to be removed.

removalOptions
RemovalOptions RemovalOptions RemovalOptions

Options that modify the removal operation.

Returns

An object that represents the asynchronous removal operation and includes progress updates.

Attributes