问题
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?
回答1:
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
- Android Custom URL to open App like in iOS
- Launch custom android application from android browser
来源:https://stackoverflow.com/questions/10520655/common-link-to-open-ios-android-and-blackberry-app