Detect an updated application in your Android app

I was searching a way to detect if a user ran an updated application to show the changelog.

In order to detect this, we have at our disposal 2 things :

int versionCode = packageInfo.versionCode;
String numberCode = packageInfo.versionName;

If you stock the versionCode in a SharedPreferences you’re now able to check if your app is update or not.

Find the source code on