Monday, April 14, 2014

How to call the version number and displayed


Rt. . . . . . . . . . . . . . . . . . . . . . . . .
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Get the current application version number:
 private String getVersionName () throws Exception 
{
/ / Get instance of
packagemanagerPackageManager packageManager = getPackageManager ();
/ / GetPackageName () is the package name of your current class, 0 is to get the version information
PackageInfo packInfo = packageManager.getPackageInfo (getPackageName (), 0);
String version = packInfo.versionName;
return version;
}


Get the current system version number:
 "Product Model:" + android.os.Build.MODEL + "," 
+ Android.os.Build.VERSION.SDK + ","
+ Android.os.Build.VERSION.RELEASE

No comments:

Post a Comment