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 ?
Find my air application version in AS3 on iOS and Android
Asked Answered
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/versions –
Etsukoetta
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];
ah cool good to know that's pretty easily accessible clean simple answer –
Etsukoetta
@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 it –
Hinman
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;
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.
© 2022 - 2024 — McMap. All rights reserved.