public static int getVersionCode(final Context context) {
        final PackageInfo packageInfo = getPackageInfo(context);
        return packageInfo != null ? packageInfo.versionCode : -1;
    }
Get the current package version code if available.

@param context the context to use
@return the current package version code, or -1 if unavailable
main/src/main/java/cgeo/geocaching/utils/Version.java