Developing a Company Hub app for Windows Phone
Applies to: Windows Phone 8 and Windows Phone Silverlight 8.1 only
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.
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:
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.
Company Hub apps must be developed as Silverlight apps.
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:
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.
This method returns a collection of IAsyncOperationWithProgress objects that represent the list of all app installations that are currently in progress.
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.
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.
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.
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.
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.
The Company Hub uses the InstallationManagerFindPackagesForCurrentPublisher() method to determine what company apps are already installed on the phone.
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.
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)
When a user taps an app that is already installed, the Company Hub uses the PackageLaunch(String) method to launch the app.