Skip to main content
marchbold
Inspiring
Nov 12, 2015 9:50 PM UTC
Question

Add custom information into application descriptor?

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 is closed to new replies. Start a new post to keep the conversation going.

5 replies

Inspiring
Sep 2, 2017 12:49 AM UTC

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

Translate
Known Participant
Sep 1, 2017 12:58 PM UTC

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;

    }

Translate
marchbold
marchboldAuthor
Inspiring
Sep 1, 2017 2:05 PM UTC

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

Cheers

Translate
air native extensions // https://airnativeextensions.com
Projectitis
Inspiring
Nov 19, 2015 8:57 AM UTC

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.

Translate
marchbold
marchboldAuthor
Inspiring
Dec 16, 2015 10:40 PM UTC

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      

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