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


var preferredApplicationDisplayName = launcherOptions.preferredApplicationDisplayName;
launcherOptions.preferredApplicationDisplayName = preferredApplicationDisplayName;

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.


// Path to the file in the app package to launch
var imageFile = "images\\test.png";

// Get the image file from the package's image directory
Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(imageFile).then(
  function (file) {
    // Set the recommended app
    var options = new 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
    Windows.System.Launcher.launchFileAsync(file, options).then(
      function (success) {
        if (success) {
            // File launched
        } else {
            // File launch failed
        }
      });
  });


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