【发布时间】:2022-01-05 15:27:47
【问题描述】:
我的应用处理深层链接。当我尝试检索我的深层链接 URL 时,我得到的不是完整的 URL(没有查询参数)。
我的 AndroidManifest:
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.test.com"
android:scheme="testlink" />
</intent-filter>
例如,我需要处理一个深层链接: testlink://www.test.com/strategy?year=2021
我正在尝试获取数据的内部活动:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getData().toString();
}
我得到一个这样的 URL:testlink://www.test.com/strategy?但预期 testlink://www.test.com/strategy?year=2021 。查询参数被剪裁。
为什么会发生这种情况?请帮帮我。
注意: 使用 HTTPS 或 HTTP 方案时,我按预期从意图中获取 URL,但是当我使用自定义方案时,查询参数丢失
【问题讨论】:
-
发布主代码。我无法从您的代码中找到 Intent。
-
您是否使用 adb 来测试深层链接?有一个已知的错误。
标签: android android-intent uri intentfilter android-deep-link