Get App Version Name
import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; class Main { public static String getAppVersionName(Context ctx, String pkgName) { try { PackageManager pm = ctx.getPackageManager(); PackageInfo pkgInfo = pm.getPackageInfo(pkgName, 0); String ver = pkgInfo.versionName; return ver; } catch (NameNotFoundException e) { return "0"; } } }