Find my air application version in AS3 on iOS and Android
Asked Answered
S

3

7

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 ?

Sama answered 17/4, 2012 at 19:43 Comment(1)
Hi Zabar just figured I'd put some thoughts out there, I don't think there is such an API. Part of the reason I imagine this is true is the application descriptor file is (in part) parsed into a AndroidManifest.xml file for Android apps I imagine something similar occurs for iOS development but I don't know that the file is retained in it's original form and haven't seen anything that obviously points back to the app version. A lot more on all other versions here senocular.com/flash/tutorials/versionsEtsukoetta
H
8

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];
Hinman answered 17/4, 2012 at 19:56 Comment(2)
ah cool good to know that's pretty easily accessible clean simple answerEtsukoetta
@Etsukoetta well this is all assuming you entered a meaningful version number in your descriptor. nativeApplication.applicationDescriptor will return your entire descriptor xml. You can then access anything you may need from itHinman
L
3

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;
Lecialecithin answered 16/12, 2013 at 18:29 Comment(0)
B
2
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.

Benisch answered 26/8, 2012 at 18:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.