gpt4 book ai didi

android - 深层链接无法在 http 方案中打开应用程序

转载 作者:行者123 更新时间:2023-11-29 02:37:45 25 4
gpt4 key购买 nike

我已经在 list 文件中的应用程序中实现了深层链接我已经像这样定义了intent-filter

<activity
android:name=".activity.ProfilePreviewActivity"
android:theme="@style/AppTheme.ActionBar.Transparent">
<intent-filter android:autoVerify="true" android:label="@string/app_name"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="appsdata2.cloudapp.net"
android:scheme="https"
/>
</intent-filter>
<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:host="appsdata2.cloudapp.net"
android:scheme="http"
/>
</intent-filter>

</activity>

现在的问题是:

我已经为两者定义了方案,还添加了 android:autoVerify="true"

在 Android 6.0.1 中安装应用

https 方案 - url 打开应用程序并完美运行

http scheme - url open browser 不是实际的App?我错过了什么吗?

我已经关注https://stackoverflow.com/a/39486914/1293313但没有运气

在 Android 7.1.1 中安装应用

https 方案 - url 打开应用程序并完美运行http 方案 - url 打开应用程序并完美运行(已编辑)

最佳答案

首先检查链接是否可以通过 adb 访问:

adb shell am start -n com.example.simon.test/.activity.ProfilePreviewActivity

只需尝试下面的代码,因为 chrome 在打开链接时有一些问题。

<activity
android:name=".activity.ProfilePreviewActivity"
android:theme="@style/AppTheme.ActionBar.Transparent">

<!-- For chrome links -->
<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="appsdata2.cloudapp.net"
android:scheme="http"
android:pathPrefix="/"/>
</intent-filter>

<!-- For adb -->
<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="appsdata2.cloudapp.net"
android:scheme="http"/>
</intent-filter>

</activity>

尝试测试来自浏览器的链接 <a href="http://appsdata2.cloudapp.net"></a>

关于android - 深层链接无法在 http 方案中打开应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46035827/

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