Skip to content

Instantly share code, notes, and snippets.

@gulafaran
Created November 7, 2015 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gulafaran/d2f50d7aa95952329099 to your computer and use it in GitHub Desktop.
Save gulafaran/d2f50d7aa95952329099 to your computer and use it in GitHub Desktop.
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