How to get application version using libgdx / robovm

I have some questions on how to get the version of the application developed on top of libgdx (as well as robovm for ios)

I want to get version information

  • This is declared in the tag android:versionName AndroidManifest.xmlfor Android
  • This is declared in the app.versionkey robovm.propertiesfor iOS. (Which, I believe, is eventually replaced by a value CFBundleShortVersionStringin Info.plist.xml)

My first question is: does libgdx provide a platform independent method to get the application version? (I could not find)

If I did not find the answer to get the version of the application on Android, this is normal. Found the same answer for iOS , but on my own path. How can I do the same with robovm backend?

+4
source share
1 answer

I don't think libgdx provides a platform independent way to do this. Here's how to get the value CFBundleShortVersionStringfor your application using RoboVM CocoaTouch bindings:

NSDictionary infoDictionary = NSBundle.getMainBundle().getInfoDictionary();
String version = infoDictionary.get(new NSString("CFBundleShortVersionString")).toString();

You can use the same method to get CFBundleVersion, etc. from your application Info.plist file.

+4
source

All Articles