5

I'm looking for a way, from a website, figuring out if an Apple App has been installed on the device or not. This could either be in the shape of a link that sends the user to the App Store and forwards from there to the app in question, or a detection method that prompted the user to install the App when it has been detected as missing. The key thing I'm looking for would be no error messages (if possible) but more importantly, that the user is not prompted to install the app if they do in-fact have it installed.

The commonly accepted solution ( Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?) does not work since the release of IOS 6 or on Chrome for iPhone/iPad/iPod Touch.

Any help with this problem would be gratefully received. :)

Community
  • 1
  • 1
Rob
  • 51
  • 1
  • From iOS 6, you can add metadata of the app you want to your html and the OS will show a banner inviting to open the app or download it depending on it being installed or not. – Moxy Dec 13 '12 at 22:45

2 Answers2

0

You can use a Custom URL Scheme to achieve that.

On the javascript side (web) you can use the javascript example presented on the following Q&A (answer by Ievgen): Determine if an app exists and launch that app on iOS

Community
  • 1
  • 1
Alon Amir
  • 4,913
  • 9
  • 47
  • 86
  • The question is about determining it from a website. – Moxy Dec 13 '12 at 22:48
  • @Moxy The answer covers that as well. – Alon Amir Dec 13 '12 at 22:50
  • So I did not that the existing solution no longer works. Also I noted that the goal was to not show error messages. Please read the question before answering next time. – Rob Dec 22 '12 at 22:40
  • If you do not want the "confirm()" message box, why not simply remove the function call to confirm(), and do whatever you like instead? – Alon Amir Dec 23 '12 at 07:34
0

Here is a concrete example of the page you would need to host on your server and link to in emails, social media, etc. Simply substitute in your app's URI and your App Store link. Note that the iframe works on more browsers.

<!DOCTYPE html>
<html>
    <body>
        <script type="text/javascript">
            window.onload = function() {
                // Deep link to your app goes here
                document.getElementById("l").src = "my_app://";

                setTimeout(function() {
                    // Link to the App Store should go here -- only fires if deep link fails                
                    window.location = "https://itunes.apple.com/us/app/my.app/id123456789?ls=1&mt=8";
                }, 500);
            };
        </script>
        <iframe id="l" width="1" height="1" style="visibility:hidden"></iframe>
    </body>
</html>

So, if the user has your app installed, the link with the URI will succeed and you will exist the browser before the script for redirecting to the App Store can be triggered. If the user does not have your app, the redirect succeeds (after a brief ugly error message).

There's a second possibility (which avoids the error messages) that relies on cookies first and the javascript redirect only as a fallback. Here's the logic:

When a user without the app first taps on a link to your app, he or she is redirected straight to the App Store. This is accomplished by a link to your app actually being a dynamically-generated page on your servers with the redirect. You create a cookie and log a "digital fingerprint" of IP address, OS, OS version, etc. on your backend.

When the user installs the app and opens it, you collect and send another "digital fingerprint" to your backend. Now your backend knows the link is installed On any subsequent visits to links associated with your app, your servers make sure that the dynamically-generated redirect page leads to the app, not the App Store, based on the cookie sent up with the request.

This avoids the ugly redirect but involves a ton more work. I work at Branch where we've built this and offer it to any developers who want to use it. If you have questions about building it from scratch, feel free to reach out.

st.derrick
  • 4,769
  • 2
  • 24
  • 25