【发布时间】:2017-07-28 08:36:04
【问题描述】:
我在AndroidManifest.xml 的intent-filter 节点中定义了一个数据标签,如下所示:
<data
android:scheme="http"
android:host="example.com"
android:pathPrefix="/path/pageEnum" />
我要捕获的路径是http://example.com/path/pageEnum?one=1&two=2&three=3
我正在从adb 发起意图,如下所示:
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://example.com/path/pageEnum?one=1&two=2&three=3"
目标活动启动成功,但是当我在onCreate()中调用getIntent().getDataString()时,字符串值为http://example.com/path/pageEnum?one=1
除第一个之外的所有查询参数都被删除。
是否有任何解决方法可以确保我获得所有查询参数?
google's documentation 中没有关于此行为的任何内容。
【问题讨论】:
-
您的
&片段可能正在被您运行adb shell命令的shell 吃掉。与其使用adb shell,不如编写一个应用程序调用startActivity(),并使用所需的Intent。 -
这就是问题所在,谢谢!
-
用单引号包裹你的 adb shell 命令:
adb shell 'am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://example.com/path/pageEnum?one=1&two=2&three=3"' -
@SimonMarquis 你的回答有效!谢谢。应该作为答案发布。
标签: android android-intent deep-linking