gpt4 book ai didi

android - 让 Android 应用程序对深层链接使用react

转载 作者:行者123 更新时间:2023-11-29 16:00:06 25 4
gpt4 key购买 nike

我正在尝试让我的 Android 应用程序对特定的深层链接格式作出 react 。我希望该应用能够处理以下格式的链接:

href="android-app://website.org/http/a_path"

我的 list 文件中有以下内容:

    <intent-filter android:label="App" >
<action android:name="android.intent.action.VIEW" />
<data
android:host="website.org"
android:scheme="http" />

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

当我从控制台对其进行测试时,该应用会对以下深层链接作出 react :

adb shell am start -a android.intent.action.VIEW -d "http://website.org/http/a_path" website.org

但它不响应我需要的格式,即:

adb shell am start -a android.intent.action.VIEW -d "android-app://website.org/http/a_path" website.org

在第二种情况下,我得到以下错误:

Activity 未启动,无法解析 Intent { act=android.intent.action.VIEW dat=http://org.website/http/a_path flg=0x10000000 pkg=website.org }

感谢任何帮助。谢谢!

最佳答案

您需要正确设置方案。

            <intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="android-app"></data>
</intent-filter>

关于android - 让 Android 应用程序对深层链接使用react,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25288637/

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