Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

i want to know when an upgrade is available for an app obviously a new apk is there. So is it that the old apk is uninstalled and new apk is installed ?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

Not quite, no. When you uninstall a package, it also removes other data to do with that package: for example, the app's own private data, its data on the SD card, your default preferences for that app. It also tells any other interested apps that you've removed the app, via an intent broadcast. Other apps receiving that broadcast might take further action based on that: for example, a launcher (home screen app) would remove desktop shortcuts and widgets from that app, since they won't work any more.

When a package is upgraded (that is, replaced with a new APK file with the same package name and a later version code), the old version is stopped, so that nothing from the app is running any more. The old APK file is removed and the new one replaces it, but the other uninstall actions aren't performed: the private app data and default preferences are kept, and the uninstall broadcast isn't sent. Instead, a different intent is broadcast to tell any interested apps that the package has been updated.

So while the old APK file is removed, the effect of an upgrade is quite different to uninstalling the old package and then installing the new one.

In Google Play the situation can be a bit different if the developer has enabled delta updates (called Smart updates by Google).

In a delta update only the changes between the two versions are downloaded and applied to the existing APK. For example, if you have an app that is 15MB in size, and the developer decides to change the background image, you don't need to download the entire application again, you can just download the delta (difference), which includes the new image. The old APK is then duplicated, the new content is injected to the copy of the old APK, and if successful the old APK is removed. The end result is the updated APK.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.