How do you Declare Meta-Data in MIT App Inventor Extension?

I'm using the MIT App Inventor extension template repository to build an extension and need to include specific meta-data in the Android manifest file. For example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.companyname.admobads">
    
    <application>
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-3940256099942544~3347511713"/>
    </application>

</manifest>

How can I declare this meta-data in my extension code using the @MetaDataElement annotation? Any guidance or examples would be greatly appreciated.

Thank you :smiling_face:

You need to import these classes :arrow_down:

import com.google.appinventor.components.annotations.UsesApplicationMetadata;
import com.google.appinventor.components.annotations.androidmanifest.MetaDataElement;

Here is your code :arrow_down:

@UsesApplicationMetadata(metaDataElements = {
    @MetaDataElement(name = "com.google.android.gms.ads.APPLICATION_ID", value = "ca-app-pub-3940256099942544~3347511713")
})

Thank you :smiling_face:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.