已安装打开移动应用的电子邮件链接

时间:2015-08-21 16:04:41

标签: android ios mobile-application

我需要一种方法在电子邮件中包含一个链接,该链接可以打开移动应用程序,也可以根据是否安装了移动应用程序将用户重定向到网站。我需要Android和IOS的解决方案,它是如何实现这一目标的一套实践?

谢谢!

2 个答案:

答案 0 :(得分:0)

我认为你需要一组答案。

对于iOS,您可以使用itms://或itms-apps://替换http://以避免重定向。

How to link to apps on the app store

对于Android,我认为您想要查看Mainfest文件的<intent-filter>元素。具体来说,请查看<data>子元素的文档。

Make a link in the Android browser start up my app?

答案 1 :(得分:0)

在Android上,你需要通过Intent Filter来处理这个问题:

    <activity
        android:name="com.permutassep.IntentEvaluator"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="your/url"
                android:scheme="http" />
            <data
                android:host="your/url"
                android:scheme="https" />

        </intent-filter>
    </activity>

您需要处理意图数据的类应如下所示:

public class IntentEvaluator extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Intent intent = null;

        if(getIntent() != null && getIntent().getData() != null){
         // Do whatever you want with the Intent data.

        }
    }
}

取自我开发的应用:https://raw.githubusercontent.com/lalongooo/permutas-sep/master/app/src/main/java/com/permutassep/IntentEvaluator.java

相关问题