我的自动化测试通过 adb shell am
发送 Intent ,但我无法指定一个额外的 字符串数组。
根据Intent class docs , 可以将 String[] 额外添加到 Intent 中。
然而 Intent specification docs因为 am
命令没有列出字符串数组类型。我在文档中看到的唯一字符串类型是普通字符串,也许是空“字符串”:
--esn <EXTRA_KEY>
Add a null extra. This option is not supported for URI intents.
-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE>
Add string data as a key-value pair.
是否可以避免仅仅为了发送字符串数组而编写 java 应用程序?
有没有办法从命令行发送一个 String[] extra?
编辑如果这种方式不可能,那么首选的方式是什么?
最佳答案
老问题,但没有答案。
adb shell am
显示所有选项,其中有:
[--esa <EXTRA_KEY> <EXTRA_STRING_VALUE>[,<EXTRA_STRING_VALUE...]]
(to embed a comma into a string escape it using "\,")
关于android - 如何从命令行发送 String[] Intent 额外值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19769716/