/* * 獲取當(dāng)前程序的版本號(hào) */ private String getVersionName() throws Exception{ //獲取packagemanager的實(shí)例 PackageManager packageManager = getPackageManager(); //getPackageName()是你當(dāng)前類的包名,0代表是獲取版本信息 PackageInfo packInfo = packageManager.getPackageInfo(getPackageName(), 0); return packInfo.versionName; }
發(fā)表評(píng)論