public static String getVersionCode ( Context context ) { if ( sVersion == null ) { try { sVersion = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) . versionName ; } catch ( PackageManager . NameNotFoundException e ) { // Can't find version; just leave it blank. Log . e ( TAG , "Error finding package " + context . getApplicationInfo ( ) . packageName ) ; } } return sVersion ; }
Return the app version code .