Android Context Get getVersionCode(Context mContext)

Here you can find the source of getVersionCode(Context mContext)

Description

get Version Code

Declaration

public static int getVersionCode(Context mContext) 

Method Source Code

//package com.java2s;

import android.content.Context;

import android.content.pm.PackageManager;

public class Main {
    public static int getVersionCode(Context mContext) {
        int versionCode = 0;
        try {// w  w  w  .j  av a 2s  .  c o m
            versionCode = mContext.getPackageManager().getPackageInfo(
                    mContext.getPackageName(), 0).versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return versionCode;
    }
}

Related

  1. getTempFile(Context context)
  2. getTimestamp(Context context)
  3. getTypeface(Context context, String name)
  4. getUserAgentString(Context context)
  5. getVersion(Context context)
  6. getVoiceSearchIMId(Context context)