I need to download apk file from server to device and then install it silently without any user interaction. I'm using a rooted android device. Is it possible to do? Is there any way I could do that?
I used following code to install the apk. But it asks from user to press Install or cancel.
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(sdcard,"Android/data/com.mycompany.android.games/temp/temp.apk")), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
context.startActivity(intent);