How to get application version using libgdx/robovm

I have some questions about getting the version of application developed on top of libgdx (and also on robovm for ios)

I want to get the version information

  1. That is declared in android:versionName tag of AndroidManifest.xml for Android
  2. That is declared in app.version key of robovm.properties for IOS. (Which, I believe, is eventually replaced for value of CFBundleShortVersionString key in Info.plist.xml)

My first question is, does libgdx provide a platform independent method for getting app version? (I could not find any)

If not I found an answer to get app version on android, that's OK. Found same answer for IOS but in a native way. How can I do same thing using robovm backend?

Answers


I don't think libgdx provides a platform independent way to do this. Here's how to get the CFBundleShortVersionString value for your app using RoboVM's 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 app's Info.plist file.


Need Your Help

help in seleting nodes inputs through xml path

xml xpath cucumber webrat

I have a form with checkboxes, each with a span with some text describing the selection, for isntance:

How to capture crash logs in Java

java error-handling crash

I'm working on a cross platform application in Java which currently works nicely on Windows, Linux and MacOS X. I'm trying to work out a nice way to do detection (and handling) of 'crashes'. Is the...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.