Developing a Company Hub app for Windows Phone

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

To provide a way for employees and other users to install company apps, you can develop a Company Hub: an app that acts as a portal to company-specific experiences on the phone. At a minimum, a Company Hub should enable users to discover, install, and optionally run the apps created by the company. Company Hubs can also provide other company-specific experiences or features, such as displaying current company news, upcoming company events, and alerts from the IT department.

Note

Companies that manage phones with Windows Intune or System Center 2012 Configuration Manager must use the Windows Phone 8 Company Portal App for Windows Intune and System Center 2012 Configuration Manager to deploy line of business apps rather than building a Company Hub app. For more information about line of business app distribution with Windows Intune or System Center 2012 Configuration Manager, see: Set up Windows Intune Direct Management for Windows Phone 8 Mobile Devices How to Manage Mobile Devices by Using the Windows Intune Connector in Configuration Manager

APIs for discovering, installing, and running company apps

The Windows Phone development tools provide methods in the Windows.Phone.Management.Deployment and Windows.ApplicationModel namespace that are specifically designed to be used in a Company Hub app to determine what other company apps are already installed on the phone, install company apps, and launch company apps after they are installed. The following table describes some of the key methods.

Note

Company Hub apps must be developed as Silverlight apps.

Method

Description

InstallationManagerFindPackagesForCurrentPublisher()()()

This method returns all the app packages (Package objects) installed on the phone with the same Publisher ID as the Company Hub app that calls this method. After the Company Hub app has the list of installed app packages, it can do the following things:

  • Determine which company apps have not yet been installed. The Company Hub app should only allow users to try to install apps that have not yet been installed.

  • Get the icon for an installed app by using the PackageGetThumbnailToken()()() method.

  • Launch an installed app by using the PackageLaunch(String) method.

InstallationManagerAddPackageAsync(String, Uri)

This method starts the installation process for a company app. There is no built-in UI that indicates the app is installing. The Company Hub can use the IAsyncOperationWithProgress object returned by this method to access details about the progress of the app installation, and it can optionally use this information to help display its own progress UI.

InstallationManagerGetPendingPackageInstalls()()()

This method returns a collection of IAsyncOperationWithProgress objects that represent the list of all app installations that are currently in progress.

PackageLaunch(String)

This method launches the company app that is represented by the current Package object. The Company Hub can use this method to launch an installed company app when a user taps the app icon or name displayed in the Company Hub.

PackageGetThumbnailToken()()()

This method returns a token that can be used to retrieve the thumbnail image for an installed company app that is represented by the current Package object. The Company Hub can use this method to display the appropriate app icon in the list of available company apps.

Company Hub app design

There are many ways that you can choose to implement how a Company Hub determines what apps are available for users to install, depending on how your company chooses to host its apps for distribution. The following steps outline one possible implementation of a Company Hub.

  1. Your company hosts its apps on a server that also exposes the XAPs and metadata about all of the apps (such as the URL for each XAP, the URL for each app icon, and the name, description, and version number for each app) through a web service.

  2. When the Company Hub starts, it retrieves metadata about all of the available XAPs from your company, and it uses this metadata to display a list of all available company apps.

  3. The Company Hub uses the InstallationManagerFindPackagesForCurrentPublisher()()() method to determine what company apps are already installed on the phone.

  4. When a user taps an app that is not installed yet, the Company Hub uses the InstallationManagerAddPackageAsync(String, Uri) method to start the app installation.

  5. Optionally, the Company Hub can display a progress UI while the app installs. To get data about the installation progress, the Company Hub defines AsyncOperationProgressHandler and AsyncOperationWithProgressCompletedHandler callback methods, and it assigns these methods to the Progress and Completed properties of the IAsyncOperationWithProgress object returned by the InstallationManagerAddPackageAsync(String, Uri) method.

    The method assigned to the Progress property is called at four different points during the install progress:

    • 5% completed (when the phone displays a pop-up window that asks the user to confirm the app installation)

    • 10% completed (after the user accepts the installation)

    • 55% completed (after the app is downloaded)

    • 100% completed (after the app is installed)

  6. When a user taps an app that is already installed, the Company Hub uses the PackageLaunch(String) method to launch the app.

See Also

Other Resources

Company app distribution for Windows Phone