At runtime, you can get properties of the application descriptor file as well as the publisher ID for an application. These are set in the applicationDescriptor and publisherID properties of the NativeApplication object.
You can read the application descriptor file of the currently running application, as an XML object, by getting the applicationDescriptor property of the NativeApplication object, as in the following:
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
You can then access the application descriptor data as an XML (E4X) object, as in the following:
var appXml:XML = NativeApplication.nativeApplication.applicationDescriptor;
var ns:Namespace = appXml.namespace();
var appId = appXml.ns::id[0];
var appVersion = appXml.ns::version[0];
var appName = appXml.ns::filename[0];
air.trace("appId:", appId);
air.trace("version:", appVersion);
air.trace("filename:", appName);
For more information, see The application descriptor file structure.
The application and publisher ids together uniquely identify an AIR application. You specify the application ID in the <id> element of the application descriptor. The publisher ID is derived from the certificate used to sign the AIR installation package.
The application ID can be read from the NativeApplication object's id property, as illustrated in the following code:
trace(NativeApplication.nativeApplication.applicationID);
The publisher ID can be read from the NativeApplication publisherID property:
trace(NativeApplication.nativeApplication.publisherID);
The publisher ID for an installed application can also be found in the META-INF/AIR/publisherid file within the application install directory.
Send me an e-mail when comments are added to this page | Comment Report