android 手机关机代码非root,怎么用代码判断android手机是否开启了ROOT 权限知道...
滿意答案
webber12333
2013.07.13
采納率:48%????等級:12
已幫助:10765人
【Android】Android 代碼判斷是否獲取ROOT權限
方法比較簡單,直接粘貼代碼
public synchronized boolean getRootAhth()
{
Process process = null;
DataOutputStream os = null;
try
{
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes("exit\n");
os.flush();
int exitValue = process.waitFor();
if (exitValue == 0)
{
return true;
} else
{
return false;
}
} catch (Exception e)
{
Log.d("*** DEBUG ***", "Unexpected error - Here is what I know: "
+ e.getMessage());
return false;
} finally
{
try
{
if (os != null)
{
os.close();
}
process.destroy();
} catch (Exception e)
{
e.printStackTrace();
}
}
}
00分享舉報
總結
以上是生活随笔為你收集整理的android 手机关机代码非root,怎么用代码判断android手机是否开启了ROOT 权限知道...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 坐标图绘制曲线,Andr
- 下一篇: unity3d读取android文本文件