如何与壳牌(BusyBox的)的Andr​​oid应用程序接口 [英] How to interface with shell (BusyBox) in Android App

查看:144
本文介绍了如何与壳牌(BusyBox的)的Andr​​oid应用程序接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将命令发送到(和接收输出)从一个标准的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()

这篇关于如何与壳牌(BusyBox的)的Andr​​oid应用程序接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆