My app needs root access, for example this code:
process p ; Try {p = Runtime.at timetime}. Exec ("su"); BufferDriver SS = New buffed reader (new input striker reader (P. JARRstream ()); String line; If (line = es.readLine ()) = null () (if line content acquails ("permission denied")) log.e ("trisTag", "root is not provided"); }} Hold (IOException e) {// TODO auto-generated cal block e.printStackTrace (); } So I know that when my root access is denied (read from the error stream). But what about it? How to go
Answers
public class root {private static string LOG_TAG = Root.class.getName (); The public is Boolean, the device root () (if (checkup method 1 ()) {returns true;} if (checker2 method) () is true;} if (checker method 3 ()) {return true;} return return; } Public Boolean Check RootMethod1 () {String build tag = android.os.build.TAGS; if (build tag! = Null & build tagcountains ("test-keys")} {return true;} description is false;} public boolean check Try RootMethod2 () {file file = new file ("/ system / app / superuser. Apk"); if (file.exists ()) {back true ;}} Hold (exception e) {} return false;} public boolean checkovermouth 3 () (if new ExecShell) execution command (SHELL_CMD.check_su_binary)! = Null) {back true; } Other {return false; }}}
No comments:
Post a Comment