tags:

views:

48

answers:

2

Hi,

In android manifest file, there is a field specifies application version. Can you please tell me if I can read that value programmically in my android code?

Thank you.

+1  A: 

Call GetApplicationContext().PackageManager().getPackageInfo(). The PackageInfo object it returns will have what you need.

Blrfl
A: 

You can access to those information through the PackageInfo class.

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

Regards

Francesco