如何在Android App中与shell(BusyBox)进行交互

Sva*_*nte 2 shell android busybox

我想从标准Android应用程序向Android shell(BusyBox)发送命令(并从中接收输出).我该怎么做呢?1小时的谷歌搜索没有产生任何结果.

非常感谢.

此致,斯万特

Vla*_*nov 6

Process proc = Runtime.getRuntime().exec("ls -la");
Run Code Online (Sandbox Code Playgroud)

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