Posts

Showing posts from September, 2015

Android - Detect Application Update via Play Store

     Android application developers would in some cases want a logic to be executed every time the application is updated via Play store or even when a new version is side loaded. In some cases, the logic needs to be executed only on upgrades and not when the user downgrades the application for different reasons.      Unfortunately, Android SDK doesn't offer an API to detect application updates. However, Android guarantees that the application specific user data wouldn't be erased. This is what lets user login work even after the application is upgraded. Few data is stored in Shared Preferences and this too wouldn't be deleted upon an update.    Developers can just keep track of the application version in the Shared Preference and query the same on application start up to check if the current version is same as the last known book kept version. If not, it would be a new version. This can be used to even detect an upgrade or downgrade. ...