[b]在android程序,实现了下载功能,用户可以批量下载多个apk程序,但想在用户下载完这些apk后,将这些apk进行批量安装。请问如何实现这种功能。[/b]
3条回答 默认 最新
laopeng301 2011-01-04 17:03关注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("*** DEBUG ***", "Unexpected error - Here is what I know: "+e.getMessage());
return false;
}
finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
// nothing
}
}
return true;
}
}
http://lazyhack.net/writing-an-android-root-application/本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报