Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Free tip: determining the application version.

Hi everybody,

 

I like to be able to determine the application version when my application runs. This is useful for bug reporting, savefiles...

 

Until today I always defined a static constant that contained the version number, but this feels a) rather error prone (I forgot to change it a few times) b)  too old-fashioned. So I went looking for a way to determine this dynamically. This is the result:

 

var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
var appVersion:String = appXml.ns::versionNumber[0];

 

 I thought I'd share this information with this community since I got so much already from it. I hope this is useful for somebody.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!