I want to install an apk file from java code. I want to do this silently without any action from user. I try this code ..
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(files[i].toString())), "application/vnd.android.package-archive");
startActivity(intent);
It works but wants the user to confirm the installation. I try
Process p;
p = Runtime.getRuntime().exec("pm -s install "+files[i].toString()+"\"");
but doesn't work i have given these permissions
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />