我在intent-filter
的AndroidManifest.xml
节点中定义了一个数据标签,如下所示:
<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"
目标活动已成功启动,但是当我在
getIntent().getDataString()
中调用onCreate()
时,字符串值为http://example.com/path/pageEnum?one=1
除第一个查询参数外,所有查询参数均被删除。
有什么解决方法可以确保我获得所有查询参数?
google's documentation中没有关于此行为的任何内容。
最佳答案
您应该用单引号将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"'