Run android program as root
Is it possible to run my program as root? I know how to run command-line native utils, but how to run Java program as root?
Solution 1:
This will work for you:
try {
Process process = Runtime.getRuntime().exec("su");
process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
You could use this for a command:
exec(new String[] { "su", "-c", COMMAND });
Best wishes, Tim