-
-
Save gulafaran/d2f50d7aa95952329099 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
package hu.accedo.commons.tools; | |
import android.os.Build; | |
import java.io.File; | |
public class RootCheck | |
{ | |
public RootCheck() | |
{ | |
} | |
private static boolean checkRootMethod1() | |
{ | |
String s = Build.TAGS; | |
return s != null && s.contains("test-keys"); | |
} | |
private static boolean checkRootMethod2() | |
{ | |
boolean flag; | |
try | |
{ | |
flag = (new File("/system/app/Superuser.apk")).exists(); | |
} | |
catch (Exception exception) | |
{ | |
return false; | |
} | |
return flag; | |
} | |
public static boolean isDeviceRooted() | |
{ | |
return checkRootMethod1() || checkRootMethod2(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment