Android的意图数据URI查询参数 [英] Android Intent Data Uri Query Parameter

查看:193
本文介绍了Android的意图数据URI查询参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用启动我的应用程序像这样的意图:

I am trying to launch my app using an intent like this:

adb shell am start -a android.intent.action.VIEW -d "my_scheme://my_host?queryParam1=QueryParam1&queryParam2=QueryParam2"

(我已经注册了数据的意图过滤器方案my_app_scheme和主机my_host)

(I have registered for the data intent filter with scheme "my_app_scheme" and host "my_host")

但是当我做

getIntent()的getData()

我得到的是URI

my_scheme:// my_host queryParam1 = QueryParam1

只有第一个查询参数是在 getIntent()设置的getData()。你知道为什么,可能是?又如何解决呢?

Only the first ever query param is set in the getIntent().getData(). Do you know why that might be? And how do I fix it?

推荐答案

通过转义&号试试吧'和;使用\

Try it by escaping the ampersand '&' using a '\'

adb shell am start -a android.intent.action.VIEW -d "my_scheme://my_host?queryParam1=QueryParam1\&queryParam2=QueryParam2"

这篇关于Android的意图数据URI查询参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆