我需要知道设备是否已植根,而且我想知道l如何请求超级用户访问权限。我想再次知道我是否获得了访问权限。 如果可能,请告诉我。我将非常感激......
答案 0 :(得分:3)
试试这个:
public static boolean isRooted() {
boolean rooted = false;
String binaryName = "su";
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 (new File(where + binaryName).exists()) {
rooted = true;
break;
}
}
return rooted;
}
在模拟器运行时要小心,它看起来像Root设备(您可以从上面的代码中看到)。