You can execute a shell command "su" using the phone library and check the error message if any. In case of no error, this means su command can be reached and the phone is rooted. You can do it in java:
public boolean isPhoneRooted(){
Process process = null;
try{
process = Runtime.getRuntime().exec("su");
return true;
} catch (Exception e) {
return false;
} finally{
if(process != null){
try{
process.destroy();
}catch (Exception e) {
}
}
}
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.