有没有办法从下载文件夹安装apk而无需在root设备上输入用户?
答案 0 :(得分:2)
您可以使用adb install命令以静默方式安装/更新APK。示例代码位于
之下public static void InstallAPK(String filename){
File file = new File(filename);
if(file.exists()){
try {
String command;
command = "adb install -r " + filename;
Process proc = Runtime.getRuntime().exec(new String[] { "su", "-c", command });
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}