android - How can I read the app version defined in the manifest file programmically? -


In the Android manifest file, there is an area that specifies the application version.

How can I read that value from the program?

You can access that information through PackageInfo class :

  PackageInfo pinfo = this.getPackageManager (). GetPackageInfo (getPackageName (), 0); Log.d ("pinfoCode", pinfo.versionCode); Log.d ("pinfoName", pinfo.versionName);  

Comments