Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find my air application version in AS3 on iOS and Android

Is there an as3 API in Air (I'm using 3.2) to access my application version ? The one I give on the App Store or Android Market ?

like image 556
zabar Avatar asked Apr 17 '12 19:04

zabar


3 Answers

Yeah you can pull it directly from the application xml descriptor. Something like this should work:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::version[0];
like image 150
francis Avatar answered Nov 06 '22 02:11

francis


Looks like it's different for Air 4.0 This worked for me:

var descriptor:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = descriptor.namespace();
var version:String = descriptor.ns::versionNumber;
like image 21
mika Avatar answered Nov 06 '22 03:11

mika


var _descriptor:XML = nativeApplication.applicationDescriptor;
var ns:Namespace = _descriptor.namespace();
var version:String = _descriptor.ns::versionNumber;

This is what works for me. "descriptor" var is used in AIR 3.2 for a UIComponentDescriptor, so I couldn't use that variable name. Also, statically accessing nativeApplication (NativeApplication.nativeApplication) gave me a null pointer reference, so I just grabbed it directly.

Lastly, versionNumber is what stores the version in AIR 3.2.

like image 44
posit labs Avatar answered Nov 06 '22 03:11

posit labs