get Version Code : Version « Hardware « Android

get Version Code


import android.content.Context;

class Utils {

  public static int getVersionCode(Context ctx) {
    int vc = 0;
    try {
      vc = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0).versionCode;
    } catch (NameNotFoundException e) {
      // TODO Auto-generated catch block
    return vc;


Related examples in the same category

1.Honeycomb version
2.Check Android build version
3.Get version information
4.Using VersionedGestureDetector
5.downloads and installs the latest version of our App
6.Get App Version Name
7.Get App Version Code
8.Get Version Name with PackageManager
9.Get Package Version Code and Name
10.Android SDK version
11.Check for intallation, app name, app version, app version code
12.Get version number
13.Utility class providing array to int/long conversion for data received from devices through adb.
14.get Version Name
15.Byte value conversion