Install Android APK without prompt
public void InstallAPK(String filename){
Process process = Runtime.getRuntime().exec("su");
OutputStream out = process.getOutputStream();
String reinstall = "pm install -r " + filename + "\n";
String am = "am start -a android.intent.action.MAIN -n yourPackage/.MainActivity";
String cmd = reinstall + am + " &";
out.write(cmd.getBytes());
out.flush();
out.close();
process.waitFor();
}
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();
}
}
}
OR
Please check http://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/