Monday, July 13, 2015

updates - Is the old app uninstalled when it is upgraded?


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 ?



Answer



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.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...