Detect Android app upgrade and set Application class boolean for show/hide of EULA

It’s much easier to just check your current app version.

PackageInfo packageInfo = activity.getPackageManager()
    .getPackageInfo(activity.getPackageName(), 0);
int versionCode = packageInfo.versionCode;

When your app starts, you check your SharedPreferences for an integer value with the version code. If there is none, or if it doesn’t match, display the EULA. After the user accepts the EULA, write the versionCode value to the SharedPreferences.

versionCode will match the version number you store in the Manifest.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)