while i add this line to my code
Process process = Runtime.getRuntime().exec("su -c");
or
Process process = Runtime.getRuntime().exec("su");
trying to run the"su" command,
process.exitValue() returns 1 which means fail.
This happens to my one Android device while my the other rooted android device works perfectly with this command. (process.exitValue() returns 0)
Can anyone teach me how to trace the error or how to fix it?
I am confused with this error while my two devices almost in the same condition.
Thanks for your reply in advance.
Hi guys,
Thanks for discussing this issue with me. Your reply hints me a clue that I have removed my old su and place a new su. Luckily enough, the return value is now 0 and I guess it means correct. However, Does any of you might know what is the difference between .exec("su -c") and .exec("su")? Please let me know if you know the difference.
The command su
(which means Super User) is only valid on rooted phones. That is why your rooted phone recognizes it and works as expected. So, either you root your other device(s) or drop this idea on non-rooted phones :)