swa*_*ner 14 android deep-linking
我们的用户不时收到电子邮件,例如更改密码.当他们点击链接时,我希望将它们发送到我们的网站,但我们的Android应用程序会被打开.
链接例如是https://www.ourdomain.com/change-password/{random-string}.
我们在应用中启用了深层链接,但它们的配置方式如下:
<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>
Run Code Online (Sandbox Code Playgroud)
因此该change-password部分不适合任何配置,但是我们的应用程序可能会被打开的原因是什么?
编辑
似乎问题是第一个data标签; 如果我评论出来,它的行为与预期一致(即https://www.ourdomain.com/change-password/1234不由应用程序处理).我不知道为什么这customhost是一个完全不同的词www.ourdomain.com...
您可以尝试将其分成不同的组件,因为即使编写正确,<intent-filter>一个应用程序也可能会感到困惑。<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="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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
321 次 |
| 最近记录: |