打开的iOS,Android和黑莓应用程序常用链接 [英] Common link to open iOS, Android and BlackBerry app

查看:212
本文介绍了打开的iOS,Android和黑莓应用程序常用链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个平台都有自己通过URL打开安装的应用程序的方式。

Android有一个可以注册一个URL模式,iOS的可以设置URL方案。

我如何通过邮件发送一个URL,并做出基于链接的网址被点击平台上的iOS和Android打开我的应用程序?

解决方案

您可以编写一个简单的网页来检测一下浏览器的请求来自然后重定向到相应的链接。例如,这里是重定向在PHP 的说明

编辑:

下面是一个code例子。在Android上它确实带来了一个弹出式,并要求用户输入,因为你的Andr​​oid知道它可以打开或者在谷歌播放网页或谷歌Play应用。这是Android上的预期的行为。我还没有尝试过的IPhone,但它不应该导致台式机电脑上弹出。

 < PHP

    如果(preg_match(/.*Android.*/,$ _ SERVER ['HTTP_USER_AGENT'])){
        头('位置:https://play.google.com/store');
    }否则,如果(preg_match(/.*iPhone.*/,$ _ SERVER ['HTTP_USER_AGENT'])){
        头('位置:http://www.apple.com/itunes/whats-on/');
    }

?>
< HTML>

<身体GT;
显示的网页桌面
< /身体GT;
< / HTML>
 

下面是一些其他的解决方案 相关问题P>

编辑:

我刚刚注意到,你要打开的程序本身不下载页面的应用程序。在code以上仍然工作。你只需要修复的网址。这两个问题适用

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?

解决方案

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

这篇关于打开的iOS,Android和黑莓应用程序常用链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆