has Su - Android Android OS

Android examples for Android OS:Root

Description

has Su

Demo Code


//package com.java2s;

import java.io.File;

public class Main {
    private static final String SU_PATH = "/system/bin/su";
    private static final String SU_PATH_X = "/system/xbin/su";

    public static boolean hasSu() {
        return findSU();
    }/*from   ww w  . j  a v a  2  s  . c o  m*/

    private static boolean findSU() {
        boolean ret = openFile(SU_PATH).exists();
        if (!ret) {
            ret = openFile(SU_PATH_X).exists();
        }
        return ret;
    }

    private static File openFile(String path) {
        return new File(path);
    }
}

Related Tutorials