2

Each platform has its own way of opening installed apps via URL.

Android has a URL pattern that can be registered, iOS you can set the URL scheme.

How do I send a single URL via mail and make that link open my app on iOS and Android based on the platform the URL was clicked?

Viren Pushpanayagam
  • 2,321
  • 6
  • 34
  • 39
  • I don't know how BlackBerry does it, but both Android and iOS can recognize a custom scheme though it's not really recommended in Android. You can register to handle that custom scheme with your app. Keep in mind that your email can be read in a variety of places though. It would break on a desktop if you used a custom scheme which is not what you want. – kabuko May 09 '12 at 17:06

1 Answers1

3

You could write a simple web page to detect what browser the request came from and then redirect to the appropriate link. For instance, here is an explanation of redirecting in PHP.

Edit:

Below is a code example. On Android it does bring up a popup and ask for user input because the you Android knows it can open either the Google Play web page or the Google Play app. This is the expected behavior on Android. I haven't tried it on the IPhone, but it shouldn't cause a popup on a desktop computer.

<?php

    if(preg_match ( "/.*Android.*/" , $_SERVER['HTTP_USER_AGENT'])){
        header( 'Location: https://play.google.com/store' ) ;
    } else if (preg_match ( "/.*iPhone.*/" , $_SERVER['HTTP_USER_AGENT'])){
        header( 'location: http://www.apple.com/itunes/whats-on/');
    }

?>
<html>

<body>
Show for web page for desktop
</body>
</html>

Here is a related question with some other solutions

Edit:

I just noticed, you want to open the app itself not the download page for the app. The code above would still work. You just need to fix the url's. These two questions apply

Community
  • 1
  • 1
Jay Askren
  • 9,793
  • 13
  • 48
  • 73