Skip to main content
marchbold
Inspiring
November 12, 2015
Question

Add custom information into application descriptor?

  • November 12, 2015
  • 3 replies
  • 1077 views

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?

This topic has been closed for replies.

3 replies

Inspiring
September 2, 2017

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.

see Using Custom Metadata Tags

Known Participant
September 1, 2017

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;

    }

marchbold
marchboldAuthor
Inspiring
September 1, 2017

Thanks for that, we are aware of the Android meta-data tags, we were looking for an AIR cross platform method though.

Cheers

air native extensions // https://airnativeextensions.com
Projectitis
Inspiring
November 19, 2015

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.

marchbold
marchboldAuthor
Inspiring
December 16, 2015

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      

air native extensions // https://airnativeextensions.com