【Android】取得 app 的版本資訊


 
PackageInfo pkgInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
verCode = pkgInfo.versionCode;
verName = pkgInfo.versionName;