//let the fielExplorer get the right of System root
public static boolean upgradeRootPermission(String pkgCodePath){
Process process=null;
DataOutputStream os=null;
try{
String cmd="chmod 777 "+pkgCodePath;
process =Runtime.getRuntime().exec("su");//transfer to root
os=new DataOutputStream(process.getOutputStream());
os.writeBytes(cmd + "\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
}catch (Exception e){
return false;
}finally {
try{if(os!=null){
os.close();
process.destroy();
}
}catch (Exception e){
}
}
return true;
}
调用方法 (放进OnCreate) upgradeRootPermission(getPackageCodePath());
android应用程序获取root权限(非root手机)
最新推荐文章于 2015-08-22 22:02:34 发布