Created
November 26, 2021 21:32
-
-
Save victorbrndls/afe5a450122d68ee72a3bfda24b560d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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