is Phone Rooted by checking system folder - Android Android OS

Android examples for Android OS:Root

Description

is Phone Rooted by checking system folder

Demo Code


//package com.java2s;

import java.io.File;

public class Main {
    public static boolean isRooted() {
        return findBinary("su");
    }//from w  w w.ja va2s  .co  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