Android Terminal and Log Dumping

Posted by J3hova on Stack Overflow See other posts from Stack Overflow or by J3hova
Published on 2010-11-04T13:14:56Z Indexed on 2010/12/23 21:54 UTC
Read the original article Hit count: 145

I am trying to send terminal commands programmaticly from an android activity. At the moment I'm using something like the following:

Process process = null;
    DataOutputStream os = null;
    process = Runtime.getRuntime().exec("su");
    os = new DataOutputStream(process.getOutputStream());
    os.writeBytes("./data/program1\n");
    os.writeBytes("./data/program2\n");
    os.writeBytes("exit\n");
    os.flush();

However, my program1 is failing to run successfully and I believe it is due to inadequate user permissions. Now for my question:

Does anyone know how I can dump the terminal to a file and save it on the phone or sdcard? The program is tying into the terminal to feed it commands, I want to know a way to open a connection the otherway and access the (what is normally visual on a terminal screen) output.

© Stack Overflow or respective owner

Related posts about android

Related posts about logging