如何与壳牌(BusyBox的)的Andr​​oid应用程序接口应用程序、壳牌、接口、Andr

由网友(哥的心,禁止访问)分享简介:我想将命令发送到(和接收输出)从一个标准的Andr​​oid应用Android的壳(BusyBox的)。我怎么会去这样做呢? 1小时谷歌搜索没有产生任何结果。 帮助非常AP preciated。问候,斯万解决方案 过程PROC =调用Runtime.getRuntime()EXEC(LS -la)。这将执行 LS...

我想将命令发送到(和接收输出)从一个标准的Andr​​oid应用Android的壳(BusyBox的)。我怎么会去这样做呢? 1小时谷歌搜索没有产生任何结果。

帮助非常AP preciated。

问候, 斯万

解决方案

 过程PROC =调用Runtime.getRuntime()EXEC(LS -la)。
 

这将执行 LS -la 命令并返回的过程。如果你想要更多的复杂的相互作用,你应该使用的输入和输出流: proc.getInputStream() proc.getOutputStream()

I want to send commands to (and receive output from) the Android shell (BusyBox) from a standard Android App. How would I go about doing this? 1 hour of googling yielded no result.

Help very appreciated.

Regards, Svante

解决方案

Process proc = Runtime.getRuntime().exec("ls -la");

This will execute ls -la command and return you the process. If you want more complicated interaction you should use input and output stream: proc.getInputStream() and proc.getOutputStream()

阅读全文

相关推荐

最新文章