is Rooted - Android Android OS

Android examples for Android OS:Root

Description

is Rooted

Demo Code

import android.util.Log;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.File;
import java.io.InputStreamReader;

public class Main{

    public static boolean isRooted() {
        return findBinary("su");
    }/*from w  w w . ja  va2s.  c o  m*/
    public static boolean findBinary(String binaryName) {
        boolean found = false;
        String[] places = { "/sbin/", "/system/bin/", "/system/xbin/",
                "/data/local/xbin/", "/data/local/bin/",
                "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/" };
        for (String where : places) {
            if (new File(where + binaryName).exists()) {
                found = true;
                break;
            }
        }
        return found;
    }

}

Related Tutorials