Android 代码判断是否获取ROOT权限

 1 /**
 2      * 判断当前手机是否有ROOT权限
 3      * @return
 4      */
 5     public boolean isRoot(){
 6         boolean bool = false;
 7 
 8         try{
 9             if ((!new File("/system/bin/su").exists()) && (!new File("/system/xbin/su").exists())){
10                 bool = false;
11             } else {
12                 bool = true;
13             }
14             Log.d(TAG, "bool = " + bool);
15         } catch (Exception e) {
16 
17         }
18         return bool;
19     }
原文地址:https://www.cnblogs.com/gaorui/p/4314391.html