android apk's silent installation

Tal Kanel picture Tal Kanel · Nov 10, 2011 · Viewed 7.7k times · Source

I'm searching for a way to program my application to install silently an apk file. I'm aware about the possibility to launch code looks something like this:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
startActivity(intent);   

but this code raising before the installation starts a dialog with the apk's require permissions and needs the user to authorization to start the installation.

Is there any way to skip this dialog? Is there any other way to install application on run-time from my code that don't requires the user interaction?

Answer

Guillaume picture Guillaume · Nov 10, 2011

No. And that's a good thing, this would be an (other) open door to malware and unwanted installs. Why do you want to do that, if you mind me asking? What's wrong with letting users know that you want to install something on their device?

Also, some details here: Silent installation on Android devices

And finally, this might be possible for rooted devices: if you write your own installer, you can bypass completely the built-in installer, and with root privilege, you can basically do what you want. But I still think that would be a serious breach of security.