简体   繁体   中英

Installing an Android apk programmatically

I am trying to install APKs from our file server, and it needs to be done silently without the user being able to choose whether or not it's installed or accept permission settings/changes. This is a legit business requirement as we are working with a device vendor to preload our applications into /system/app. This is a custom Android tablet device, and as such, our business unit want to ensure we can push app updates (ie force the latest version).

I understand the usual security restrictions, but there seems to be a mechanism to install applications silently for vendor/manufacture level apps. However the information on how to do this seems very spotty at best.

It seems the package installer must be in /system/app and the installer must have the same signing cert key as the app being installed. That's not a problem, but info on how to implement this feature using this flow is something I have yet to find.

Anyone ever done this before?

I'm fairly certain you'll need to ship them a custom Android ROM that allows you to be able to do this (which I doubt their business will enjoy).

The Amazon App Store on a normal device can't install silently in the background like Google Play can. Maybe the Kindle Fire can do this (I don't own one), but if it can, its because its running on a custom ROM built by Amazon.

The best thing you could do is launch an intent that tells brings the user to the app needs to be updated, which brings them to installer activity, which then requires user interaction.

Not exactly an answer. However, we recently faced similar requirement for an android client-server app.

Whenever the application contacts server with a request, it sends the current versionCode as well.

PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
//pInfo.versionCode;
//pInfo.versionName;

On server side we check the versionCode and if we have a new version, informs the client and client forces the user to upgrade to the new version. The client app will not work until it is upgraded to the new version. But obviously user can choose to not install etc.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM