app/src/main/java/org/andstatus/app/FirstActivity.java
/**
     * @return true if we opened previous version
     */
@return true if we opened previous version
@return true if we opened previous version
public static boolean checkAndUpdateLastOpenedAppVersion(Context context, boolean update) {
        boolean changed = false;
        long versionCodeLast =  SharedPreferencesUtil.getLong(MyPreferences.KEY_VERSION_CODE_LAST);
        PackageManager pm = context.getPackageManager();
        PackageInfo pi;
        try {
            pi = pm.getPackageInfo(context.getPackageName(), 0);
            int versionCode =  pi.versionCode;
            if (versionCodeLast < versionCode) {
                MyLog.v(TAG, () -> "Last opened version=" + versionCodeLast
                        + ", current is " + versionCode
                        + (update ? ", updating" : "")
                );
                changed = true;
                if ( update && myContextHolder.getNow().isReady()) {
                    SharedPreferencesUtil.putLong(MyPreferences.KEY_VERSION_CODE_LAST, versionCode);
                }
            }
        } catch (PackageManager.NameNotFoundException e) {
            MyLog.e(TAG, "Unable to obtain package information", e);
        }
        return changed;
    }
public static boolean checkAndUpdateLastOpenedAppVersion ( Context context , boolean update ) { boolean changed = false ; long versionCodeLast = SharedPreferencesUtil . getLong ( MyPreferences . KEY_VERSION_CODE_LAST ) ; PackageManager pm = context . getPackageManager ( ) ; PackageInfo pi ; try { pi = pm . getPackageInfo ( context . getPackageName ( ) , 0 ) ; int versionCode = pi . versionCode ; if ( versionCodeLast < versionCode ) { MyLog . v ( TAG , ( ) -> "Last opened version=" + versionCodeLast + ", current is " + versionCode + ( update ? ", updating" : "" ) ) ; changed = true ; if ( update && myContextHolder . getNow ( ) . isReady ( ) ) { SharedPreferencesUtil . putLong ( MyPreferences . KEY_VERSION_CODE_LAST , versionCode ) ; } } } catch ( PackageManager . NameNotFoundException e ) { MyLog . e ( TAG , "Unable to obtain package information" , e ) ; } return changed ; }
@return true if we opened previous version
@return true if we opened previous version
// Even if the Actor will see only the first page of the Help activity, // count this as showing the Change Log