怎麼擷取root許可權,這是個問題。網上說用mk+uid能獲得,早之前我只會用cmd去擷取,而且還要安裝一個superuser前提還要是已經破解過的
代碼如下:(求大神賜教mk的方法)
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(" exit \n");
os.writeBytes(" exit \n");
os.flush();
process.waitFor();
} catch (Exception e) {
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}//先擷取應用root Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(" reboot -p \n");//重啟代碼= = 我在cmd裡面su了之後還是不能關機,只能重啟。哎。
os.flush();
process.waitFor();
} catch (Exception e) {
} finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
}
}
求大神賜教真正擷取root許可權。