LauncherOptions.PreferredApplicationDisplayName | preferredApplicationDisplayName property

Applies to Windows and Windows Phone

Gets or sets a value that represents the display name of the app in the store that the user should install if no app exists to handle the file type or URI.

Syntax

Public Property PreferredApplicationDisplayName As String

Property value

Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]

The display name of the app.

Remarks

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.

Examples

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


Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.System
Windows::System [C++]

Metadata

Windows.winmd

See also

LauncherOptions
Samples
Association launching sample
Tasks
How to launch the default app for a file (JavaScript)
How to launch the default app for a file (C#/VB/C++)
How to launch the default app for a URI (JavaScript)
How to launch the default app for a URI (C#/VB/C++)
Guidelines
Guidelines and checklist for file types and URIs
Reference
Launcher.LaunchFileAsync(IStorageFile, LauncherOptions)
Launcher.LaunchUriAsync(Uri, LauncherOptions)

 

 

Show:
© 2014 Microsoft. All rights reserved.