How To Check If Android Phone Is Rooted?
I want to programatically find in my application if the android phone is rooted. I found many links like: Determine if running on a rooted device Effective way to programatically
Solution 1:
I've wrapped this code (working ok without any other external jar/lib) from RootTools
privatestaticbooleanisRooted() {
returnfindBinary("su");
}
publicstaticbooleanfindBinary(String binaryName) {
boolean found = false;
if (!found) {
String[] places = {"/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/",
"/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/"};
for (String where : places) {
if ( newFile( where + binaryName ).exists() ) {
found = true;
break;
}
}
}
return found;
}
Solution 2:
You can use the roottools library. They offer a method to check for root access. https://code.google.com/p/roottools/
Post a Comment for "How To Check If Android Phone Is Rooted?"