Android 台灣中文網
標題:
應用程序獲取權限(手機須root)
[打印本頁]
作者:
lkk47
時間:
2011-10-31 15:59
標題:
應用程序獲取權限(手機須root)
public static boolean runRootCommand(String command) {
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
Log.d(TAG, "the device is not rooted, error message: " + e.getMessage());
return false;
} finally {
try {
if (os != null) {
os.close();
}
if(process != null) {
process.destroy();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return true;
}
複製代碼
這是轉載的不知道圖片也能不能一起轉載
如果不清楚可至轉載網站查詢
轉載於:
http://www.eoeandroid.com/forum.php?mod=viewthread&tid=65892
作者:
ploglin
時間:
2011-11-1 08:58
看起來就是在下command前,先下 su 的 command,受教了。
作者:
lobos
時間:
2011-11-7 03:11
看不懂ㄝ...
作者:
king80301
時間:
2012-2-14 06:57
這是啥?????
作者:
kanojerry
時間:
2012-2-26 19:47
謝謝提供,正在找ROOT的程式碼
歡迎光臨 Android 台灣中文網 (https://apk.tw/)
Powered by Discuz! X3.1