问题
Is there a way of installing an apk from downloads folder without user input on a rooted device?
回答1:
You can simply use adb install command to install/update APK silently. Sample code is below
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();
}
}
}
来源:https://stackoverflow.com/questions/41325266/install-apk-using-root