Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Reading the Meta-Data information from AndroidManifest #1860

Description

@smaugho

For the creation of some plugins, it is very useful to be able to read the Meta-Data information from the AndroidManifest file.

For instance, in the implementation of a plugin that integrates with Facebook SDK, it is very useful to validate the correct configuration of the Application:

        final String FACEBOOK_APP_ID_NAME = "com.facebook.sdk.ApplicationId";
        final String facebookAppIdValue = getEnvironment().getAndroidManifest().getMetaDataQualifiedNames().get(FACEBOOK_APP_ID_NAME);
        if (facebookAppIdValue == null) {
            valid.addError( 
                    "Your application must include the meta-data named " + FACEBOOK_APP_ID_NAME + "." + 
                    "\nEx. <meta-data android:name=\"com.facebook.sdk.ApplicationId\"" +
                    "\n             android:value=\"<Your Facebook App Id>\"/>"
                );
        }

        final String FACEBOOK_LOGIN_ACTIVITY_NAME = "com.facebook.LoginActivity";
        if (!getEnvironment().getAndroidManifest().getComponentQualifiedNames().contains(FACEBOOK_LOGIN_ACTIVITY_NAME)) {
            valid.addError( 
                    "Your application must declare " + FACEBOOK_LOGIN_ACTIVITY_NAME + " activity." + 
                    "\nEx. <activity android:name=\"com.facebook.LoginActivity\"/>"
                );
        }

I did already an implementation for this feature, adding a getMetaDataQualifiedNames method to the AndroidManifest 86f6f18

There's many 3rd parties libraries that check for Meta-Data information, this would facilitate the integration and validations with such libraries.

Activity

  1. WonderCsabo commented on Oct 2, 2016

    @WonderCsabo
    Member

    Feel free to open a pull request with this feature. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions