You can install package using the following code
public static void rebootAndUpdate(Context context, String filePath) {
File updateFile = new File(filePath);
if (!updateFile.exists()) {
return;
}
try {
Class<?> sysClass = Class.forName("android.os.RecoverySystem");
Method method = sysClass.getMethod("installPackage",
new Class[]{Context.class, File.class, boolean.class});
method.invoke(null, context, updateFile, false);
} catch (Exception e) {
e.printStackTrace();
}
}