gpt4 book ai didi

android - Intent 过滤器数据路径中的哈希符号

转载 作者:搜寻专家 更新时间:2023-11-01 09:47:33 25 4
gpt4 key购买 nike

这是我的 AndroidMaifest.xml 的一部分:

<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:scheme="http" />
<data android:scheme="https" />
<data android:host="myhost.com" />
</intent-filter>

现在我想用我的应用程序打开以下链接:myhost.com/my/pathmyhost.com/my/#/path。它们都在应用程序中打开,但对于第一个 getIntent().getData().getPath() 返回 /my/path (这是正确的),但对于第二个它返回 /my(它应该是 /my/#/path)。我是不是想错了,或者 # 不知何故被窃听并切断了路径?

最佳答案

答案在这里。而不是

Uri uri = getIntent().getData()

我现在用

String uriString = Uri.encode(getIntent().getDataString(), "/:?&="); // I'm not sure if those are all characters that should be allowed
Uri uri = Uri.parse(uriString);

希望对大家有所帮助!

关于android - Intent 过滤器数据路径中的哈希符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37255262/

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