Android判断是否root
2016-05-16 11:35
302 查看
try {
if (Runtime.getRuntime().exec("su").getOutputStream() == null) {
Toast.makeText(this, "没有root!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "已经root!", Toast.LENGTH_SHORT).show();
}
} catch (IOException e) {
e.printStackTrace();
}
if (Runtime.getRuntime().exec("su").getOutputStream() == null) {
Toast.makeText(this, "没有root!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "已经root!", Toast.LENGTH_SHORT).show();
}
} catch (IOException e) {
e.printStackTrace();
}
相关文章推荐
- Android EventBus源码解析 带你深入理解EventBus
- android view转化为image来实现某些功能
- Android 自定义View并添加属性
- android studio2.1创建项目的两个坑
- Android开发到底做什么?
- Android ServiceConnection
- Android:用Handler实现异步处理功能
- Android studio 如何修改工程的包名
- Android开发中,有哪些让你觉得相见恨晚的方法、类或接口
- Android开发中一些被冷落但却很有用的类和方法
- android:ListView的局部刷新
- Android Sqlite 数据库版本更新
- Android ANR产生原因和解决办法
- android 文档
- Android中使用广播机制退出多个Activity
- Android换肤
- find5 刷安卓4.4 魔趣
- 关于屏幕适配的学习(support-screens)
- Android探索之BroadcastReceiver具体使用以及安全性探究
- Android SingleTask 探究