Read command output inside su process
Ok, I’ve found a solution. It should look like this: Process p = Runtime.getRuntime().exec(new String[]{“su”, “-c”, “system/bin/sh”}); DataOutputStream stdin = new DataOutputStream(p.getOutputStream()); //from here all commands are executed with su permissions stdin.writeBytes(“ls /data\n”); // \n executes the command InputStream stdout = p.getInputStream(); byte[] buffer = new byte[BUFF_LEN]; int read; String out = new String(); //read … Read more