Andorid的Deeplinking不使用多个方案 [英] Andorid Deeplinking not working with multiple schemes

查看:111
本文介绍了Andorid的Deeplinking不使用多个方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我坚持以下情形。我的Manifest.xml定义了以下deeplinks

I am stuck with the following scenario. I defined the following deeplinks in Manifest.xml

预期的行为是当我发现一个URL格式的 http://www.domain.com/a /布拉布拉或有格式的短信/电子邮件中的链接域/ XYZ的应用程序会触发我的活动。

Expected behavior is when I found a url of format "http://www.domain.com/a/blabla" or when there is link in SMS/eMail of format "domain/xyz" app should trigger my activity.

    CASE 1: WORKING FINE
    <activity
        android:name=".MYActivity">
        <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="xyz"
                android:scheme="domain" />
        </intent-filter>
    </activity>

    CASE 2: WORKING FINE
     <activity
        android:name="MYActivity">
        <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:scheme="http" 
                android:host="www.domain.com"
                android:pathPrefix="/a"
             />
        </intent-filter>
    </activity>

    CASE 3: NOT WORKING
    <activity
        android:name="MYActivity">
        <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="xyz"
                android:scheme="domain" />
             <data
                android:scheme="http" 
                android:host="www.domain.com"
                android:pathPrefix="/a"
             />
        </intent-filter>
    </activity>

任何建议/点/帮助实在是AP preciated

Any suggestions/points/help is really appreciated

推荐答案

见的 &lt;数据&GT; :它说:

See the documentation of <data>: it states that:

所有&lt;数据&GT;包含在同一&LT在元素;意向滤光器&gt; 元素有助于同样的过滤器。

All the <data> elements contained within the same <intent-filter> element contribute to the same filter.

因此​​

<data
    android:host="xyz"
    android:scheme="domain" />
<data
    android:scheme="http" 
    android:host="www.domain.com"
    android:pathPrefix="/a" />

等同于

<data
    android:host="xyz"
    android:scheme="domain"
    android:scheme="http" 
    android:host="www.domain.com"
    android:pathPrefix="/a" />

这显然有一定的矛盾,那就是主机是 XYZ www.domain.com

这篇关于Andorid的Deeplinking不使用多个方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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