版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/l460133921/article/details/84788350
问题复现场景
在mac或windows 下执行如下命令:
adb shell am start -a android.intent.action.VIEW -d "https://xxx?action=tab&tabname=offer"
发现应用在接收到intent后,intent中的参数变为“https://xxx?action=tab”。
问题原因
adb shell相当于是在linux shell环境下运行的,而&符号是shell中的特殊字符,表示后台运行,因此会出现截断的情况。
解决方法
方法一:
adb shell
am start -a android.intent.action.VIEW -d 'https://xxx?action=tab&tabname=offer'
方法二:
adb shell am start -a android.intent.action.VIEW -d "https://xxx?action=tab'&'tabname=offer"
至于如下命令为何不行,可能和操作系统相关,具体原因不详。
adb shell am start -a android.intent.action.VIEW -d 'https://xxx?action=tab&tabname=offer'