Hi Friends,
It is very easy to get version code and version name of any android application programmatically.
This should be done using PackageInfo, See following example,
PackageManager pm=getApplicationContext().getPackageManager();
PackageInfo pi=pm.getPackageInfo(getApplicationContext().getPackageName(), 0);
System.out.println("Version Code="+pi.versionCode+"\n Version Name="+pi.versionName);
For more details Click Here
References:
PackageManager
PackageInfo
It is very easy to get version code and version name of any android application programmatically.
This should be done using PackageInfo, See following example,
PackageManager pm=getApplicationContext().getPackageManager();
PackageInfo pi=pm.getPackageInfo(getApplicationContext().getPackageName(), 0);
System.out.println("Version Code="+pi.versionCode+"\n Version Name="+pi.versionName);
For more details Click Here
References:
PackageManager
PackageInfo
No comments:
Post a Comment