Is phone Rooted - Android Android OS

Android examples for Android OS:Root

Description

Is phone Rooted

Demo Code


//package com.java2s;
import android.content.Context;

import java.io.File;

public class Main {
    public static boolean phoneRooted(Context mContext) {
        boolean ret = false;
        String[] files = new String[] { "/system/bin/su",
                "/system/xbin/su", "/system/sbin/su" };
        for (int i = 0; i < files.length; i++) {
            File f = new File(files[i]);
            if (f.exists()) {
                ret = true;//from   ww  w  .  ja v  a2s .  c o m
                break;
            }
        }
        return ret;
    }
}

Related Tutorials