且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2023-02-08 19:49:57

 过程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()