Posted By

kajinka13 on 02/07/12


Tagged

root android Superuser


Versions (?)

Ottenere il privilegio di root


 / Published in: Java
 

Ottenere il privilegio di root

  1.  
  2. try {
  3. p = Runtime.getRuntime().exec("su");
  4.  
  5. DataOutputStream os = new DataOutputStream(p.getOutputStream());
  6. os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
  7. os.writeBytes("exit\n");
  8. os.flush();
  9.  
  10. try {
  11. p.waitFor();
  12. if(p.exitValue() != 255)
  13. toastMessage("root");
  14. else
  15. toastMessage("not root");
  16. } catch(InterruptedException e) {
  17. toastMessage("not root");
  18. }
  19. } catch(IOException e) {
  20. toastMessage("not root");
  21. }

Report this snippet  

You need to login to post a comment.