LauncherOptions.PreferredApplicationPackageFamilyName | preferredApplicationPackageFamilyName property
Gets or sets a value that represents the package family name of the app in the Store that the user should install if no app exists to handle the file type or URI.
The package family name of the app.
In some cases the user may not have an app installed to handle the file that you are launching. By default, Windows will handle these cases by providing the user with a link to search for an appropriate app on the store. Use LauncherOptions.PreferredApplicationDisplayName in conjunction with LauncherOptions.preferredApplicationPackageFamilyName to provide the user with an app in the Windows Store that they can acquire to handle the file. The display name that you use should correspond to the display name of the app in the Windows Store.
You must set both of these preferred application properties to recommend an app. Setting one without the other will result in a failure.
Note You cannot set the preferred application properties and the fallback URI at the same time, since only one fallback may be used. The Launcher API will fail if both fallbacks are set.
Call the Launcher.LaunchFileAsync(IStorageFile, LauncherOptions) | launchFileAsync(IStorageFile, LauncherOptions) method with preferredApplicationDisplayName set to the display name of an app in the Windows Store and the preferredApplicationPackageFamilyName set to the package family name of an app in the Windows Store.
async Sub DefaultLaunch() ' Path to the file in the app package to launch Dim imageFile = "images\test.png" ' Get the image file from the package's image directory Dim file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile) If file IsNot Nothing Then ' Set the recommended app Dim options = Windows.System.LauncherOptions() options.PreferredApplicationPackageFamilyName = “Contoso.FileApp_8wknc82po1e”; options.PreferredApplicationDisplayName = “Contoso File App”; ' Launch the retrieved file pass in the recommended app ' in case the user has no apps installed to handle the file Dim success = await Windows.System.Launcher.LaunchFileAsync(file) If success Then ' File launched Else ' File launch failed End If Else ' Could not find file End If End Sub
Minimum supported client
Minimum supported server
|Windows Server 2012|
Minimum supported phone
|Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]|
- Association launching sample
- How to launch the default app for a file (C#/VB/C++)
- How to launch the default app for a URI (C#/VB/C++)
- Guidelines and checklist for file types and URIs
- Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
- Launcher.LaunchUriAsync(Uri, LauncherOptions)