首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android应用程序是通过电子邮件发送的链接打开的。

Android应用程序是通过电子邮件发送的链接打开的。
EN

Stack Overflow用户
提问于 2017-01-26 07:45:00
回答 1查看 342关注 0票数 14

我们的用户不时收到电子邮件,例如更改他们的密码。当他们点击链接,我想让他们发送到我们的网站,但我们的Android应用程序被打开。

例如,链接是https://www.ourdomain.com/change-password/{random-string}

我们的应用程序中确实启用了深度链接,但它们的配置方式如下:

代码语言:javascript
复制
            <intent-filter android:label="...">
            <action android:name="android.intent.action.VIEW" />

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

            <data
                android:host="customhost"
                android:pathPrefix="/"
                android:scheme="https" />

            <data
                android:host="www.ourdomain.com"
                android:pathPrefix="/somethingelse"
                android:scheme="https" />

            <data
                android:host="www.ourdomain.com"
                android:pathPrefix="/againsomethingelse"
                android:scheme="https" />

            <data
                android:host="someothercustomhost"
                android:scheme="https" />

            <data
                android:host="andagainacustomhost"
                android:scheme="https" />
        </intent-filter>

因此,change-password部分不适合这些配置,我们的应用程序被打开的原因是什么?

编辑

问题似乎是第一个data-tag;如果我将其注释掉,它的行为就像预期的那样(即https://www.ourdomain.com/change-password/1234不是由应用程序处理的)。我不知道为什么customhostwww.ourdomain.com完全不同.

EN

回答 1

Stack Overflow用户

发布于 2017-01-28 09:46:51

您可能会尝试将其分离为不同的<intent-filter>组件,因为使用一个<intent-filter>应用程序可能会混淆,即使它是正确编写的。

代码语言:javascript
复制
<intent-filter android:label="...">
    <action android:name="android.intent.action.VIEW" />

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

    <data android:host="www.ourdomain.com"
        android:pathPrefix="/somethingelse"
        android:scheme="https" />

    <data android:host="www.ourdomain.com"
        android:pathPrefix="/againsomethingelse"
        android:scheme="https" />
</intent-filter>

<intent-filter android:label="...">
    <action android:name="android.intent.action.VIEW" />

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

    <data android:host="customhost"
        android:pathPrefix="/"
        android:scheme="https" />
</intent-filter>

<intent-filter android:label="...">
    <action android:name="android.intent.action.VIEW" />

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

    <data android:host="someothercustomhost"
        android:scheme="https" />
</intent-filter>

<intent-filter android:label="...">
    <action android:name="android.intent.action.VIEW" />

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

    <data android:host="andagainacustomhost"
        android:scheme="https" />
</intent-filter>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41868819

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档