I am trying to use SuperUser commands to create a list of files that are in a certain location. I am using the method laid out in this post:
Android using Super User Permissions ? allowing access
My specific code looks like this:
try {
Process process = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(process.getOutputStream());
DataInputStream inputStream = new DataInputStream(process.getInputStream());
outputStream.writeBytes("cd " + baseDirectory + "/system/app" + "\n");
outputStream.flush();
outputStream.writeBytes("ls" + "\n");
outputStream.flush();
outputStream.writeBytes("exit\n");
outputStream.flush();
process.waitFor();
} catch (IOException e) {
} catch (InterruptedException e) {
}
and it runs without any errors. My problem is that I can't figure out how to produce any output.
Please note that in the code I am trying to get a list of Apps (I know I can do this in different ways) but I need it to work in a general case...