Android In Code获取App的版本?
问题描述:
我正在寻找获取应用程序版本的方法,以便可以在Android应用程序的关于"屏幕中显示它.
I'm looking for the way to get the version of the app so I can display it in the About screen in my Android app.
在iOS(MonoTouch.net)中,我们只需要这样做:
In iOS (MonoTouch.net) we'd just do this:
NSBundle.MainBundle.ObjectForInfoDictionary ("CFBundleVersion").ToString ();
答
您可以使用版本代码和 VersionName
You can use the PackageManager.GetPackageInfo method to get access to all sorts of information about your app, including VersionCode and VersionName