This seems to work, but I'm not sure, as I am limited (AVD) in my ability to test it. I came up with this algorithm to check if I am teaching. Do you think this will always work? I'm not sure.
private boolean isRooted() { try { Process process = new ProcessBuilder() .command("/system/bin/su") .redirectErrorStream(false) .start(); } catch (IOException e) { return false; } return true; }
java android
Tom
source share