gpt4 book ai didi

Android:应用程序链接 - 仅支持某些路径?

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:30:32 25 4
gpt4 key购买 nike

我想为我的应用程序设置应用程序链接,但只是为了它在某些路径上处于 Activity 状态。换句话说,在我的 list 中:

<intent-filter  android:autoVerify="true">
<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.mydomain.com/[mypath]" />
<data android:scheme="https" android:host="www.mydomain.com/[mypath]" />
</intent-filter>

我不希望包含我的域的每个 url 都可以打开应用程序 - 它们可以像往常一样在浏览器中打开。我只希望包含特定子路径的网址在应用程序中打开。应用程序链接是否允许此模式或它是“全有或全无”?

开发者文档链接: http://developer.android.com/training/app-links/index.html

最佳答案

您可以有特殊路径,但不能/不应该将它们附加到主机。

你应该有

<data android:scheme="https" android:host="www.mydomain.com" />

然后您可以使用 android:path android:pathPattern 或 android:pathPrefix 来创建特殊模式。

例如,

<data android:scheme="https" android:host="www.google.com" android:path="/en/index.html"/>

只会捕获 url "https://www.google.com/en/index.html "

关于Android:应用程序链接 - 仅支持某些路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36374902/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com