gpt4 book ai didi

Android 在 & 符号后修剪其余的深层链接 URI

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:47:07 25 4
gpt4 key购买 nike

我正在尝试向我的 Android 应用程序添加另一个深层链接,我希望我的 URI 看起来像这样:my_app://photos?id=147619727001201&edit=true。问题是系统无法识别此 URI,所以我只得到它的修剪版本 (my_app://photos?id=147619727001201)。我只是好奇 android 系统如何处理深层链接,以及是否有任何方法可以使这个 URI 工作。我不想提及我的其他 URI 一切正常,它们不包含 & 符号。这是我的 Intent 过滤器:

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

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

<data
android:path="/photos"
android:pathPattern="\?"
android:scheme="my_app" />
</intent-filter>

这是我的 Activity 创建方法:

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Uri target = getIntent().getData();
}

在以下命令之后:

adb shell am start -a android.intent.action.VIEW -d "my_app://photos?id=170262497002201&edit=true"

我在 target.toString(); 中得到 my_app://photos?id=170262497002201

最佳答案

您也可以尝试通过在其前添加“\”来转义“&”字符

例如:

adb shell am start -a android.intent.action.VIEW -d "fantasticapp://www/?cc=de\&tagset=123" robertoduran.isthegreatest

关于Android 在 & 符号后修剪其余的深层链接 URI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30451510/

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