Copy link to clipboard
Copied
Hi,
Is it possible to add a 'custom' node into an AIR application descriptor? I was hoping to be able to read a specific field from the file eg:
<application xmlns="http://ns.adobe.com/air/application/20.0">
<id>com.application.id</id>
<filename>Test</filename>
<name>Test App</name>
<versionNumber>0.0.1</versionNumber>
<customNode>value</customNode>
</application>
However it seems nodes like this are stripped out of the packaged application. Any ideas how to add something like this? Or suggestions as to a better method?
Copy link to clipboard
Copied
It depends on your platform, but you could try putting it in the description field? I'm not sure that the description field is used at all on Android or iOS, but I haven't checked the bundle to see if the field has also been stripped. It also won't help you on other platforms.
Loving your ANE's by the way.
Copy link to clipboard
Copied
Thanks,
The description field is an option, but we are trying to use a method that doesn't interfere with the standard usage and would like to keep it cross platform as much as possible.
Cheers
Copy link to clipboard
Copied
for android add a custom meta to xml manifest file.
<meta-data android:name="send_launch_scheme" android:value="xdev" />
then read that value from metada property of ApplicationInfo
private String readMetaScheme(){
String send_launch_scheme = null;
try {
ApplicationInfo ai = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;
send_launch_scheme = bundle.getString("send_launch_scheme");
} catch (NameNotFoundException e) {
Log.e(TAG, "Failed to load meta-data, NameNotFound: " + e.getMessage());
} catch (NullPointerException e) {
Log.e(TAG, "Failed to load meta-data, NullPointer: " + e.getMessage());
}
return send_launch_scheme;
}
Copy link to clipboard
Copied
Thanks for that, we are aware of the Android meta-data tags, we were looking for an AIR cross platform method though.
Cheers
Copy link to clipboard
Copied
you can also add metadata to the SWF file itself
see: Adding metadata to SWF files​
and then at loading times you can read the loaderInfo.bytes to parse and get back that data
and/or you can use a custom metadata in AS3
eg.
[mystuff(name="foobar", desc="something")]
public class Whatever {}
then in compiler options use keep-as3-metadata=mystuff
then in AS3 use describeType to get the values etc.