Return to Snippet

Revision: 55439
at February 7, 2012 07:21 by kajinka13


Initial Code
Process p; 

try { 
	p = Runtime.getRuntime().exec("su"); 
	
	DataOutputStream os = new DataOutputStream(p.getOutputStream()); 
   	os.writeBytes("echo \"Do I have root?\" >/system/sd/temporary.txt\n");
   	os.writeBytes("exit\n"); 
   	os.flush(); 
   
	try {
   		p.waitFor(); 
   		if(p.exitValue() != 255)
   			toastMessage("root");
    	else
    		toastMessage("not root");    
	} catch(InterruptedException e) { 
		toastMessage("not root"); 
	} 
} catch(IOException e) { 
	toastMessage("not root"); 
}

Initial URL

                                

Initial Description
Ottenere il privilegio di root

Initial Title
Ottenere il privilegio di root

Initial Tags
android

Initial Language
Java