Skip to content

Instantly share code, notes, and snippets.

@victorbrndls
Created November 26, 2021 21:32
Show Gist options
  • Save victorbrndls/afe5a450122d68ee72a3bfda24b560d1 to your computer and use it in GitHub Desktop.
Save victorbrndls/afe5a450122d68ee72a3bfda24b560d1 to your computer and use it in GitHub Desktop.
public static boolean isRooted(Context context) {
boolean isEmulator = isEmulator(context);
String buildTags = Build.TAGS;
if (!isEmulator && buildTags != null && buildTags.contains("test-keys")) {
return true;
} else {
File file = new File("/system/app/Superuser.apk");
if (file.exists()) {
return true;
} else {
file = new File("/system/xbin/su");
return !isEmulator && file.exists();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment