locked
How to know if an app is installed ?

    Question

  • hi,

    I want to launch an app #2 inside my app #1 or if it is not installed, redirect to the store.

    In app #2, I register a specific file Extension (for example : .myspecificapp) described in the documentation : How to handle file activation 

    In app #1, I use the Windows.System.Launcher :

    // Path to the file to launch, relative to the package's install directory.
        var fileToLaunch = "files\\file.myspecificapp";
    
        // Launch a .png file that came with the package.
        function launchFile() {
            // First, get the image file from the package's image directory.
            
            Windows.ApplicationModel.Package.current.installedLocation.getFileAsync(fileToLaunch).then(
                function (file) {
                    // Now launch the retrieved file.
                    Windows.System.Launcher.launchFileAsync(file).then(
                        function (success) {
                            if (success) {
                                WinJS.log && WinJS.log("File " + file.name + " launched.", "sample", "status");
                            } else {
                                WinJS.log && WinJS.log("File launch failed.", "sample", "error");
                            }
                        });
                });
        }

    But the problem is if app #2 is not installed on my system, Metro shows a popup as if I had enabled the displayApplicationPicker to true. In this case, I would like redirect the user to the store.

    Is it possible to know if an application is installed or have you another idea to implement this case ?

    Thursday, April 05, 2012 9:23 AM

Answers

  • There is no way to tell if another app is installed from a Metro style app. Metro style apps are standalone and cannot interact with other applications (from a desktop app you could use the PackageManager).

    One of the options on the application picker is to pick an app from the store, so your users will have that link without your forcing it.

    If the apps are always supposed to go together then you could put them both in the same app package so they are installed and uninstalled as a group. See App packages and deployment for more information on how to create and deploy app packages. How to create a basic package manifest describes how to edit the manifest in a text editor rather than in Visual Studio. You will need to do that to include multiple <Application> sections.

    --Rob

    Thursday, April 05, 2012 10:34 PM
    Owner