I am trying to run
String command = "su -c 'busybox ls /data'";
p = Runtime.getRuntime().exec(command);
in my app, but it seems like the syntax is somehow wrong. I have no problem running it from the terminal emulator app on the phone, though, so I just can't understand why it is not working when called from within my app.
Any help is deeply appreciated!
Use the function below:
Usage:
SOLUTION FOUND! Thanks to the link suggested by onit here. See the code below: for superuser shell commands to work properly, you first need to create a superuser shell and assign it to a process, then write and read on it's input and output streams respectively.