Search code examples
cordovaionic-frameworkionic3cordova-pluginsappsflyer-cordova-sdk

Add custom config into AndroidManifest.xml


I am using cordova and one third party plugin which has a block of setting missing from AndroidManifest.xml file. I have checked custom-config from npm but still can't figure out how to enter the following code from config.xml into the xml file.

<receiver android:exported="true" android:name="com.appsflyer.MultipleInstallBroadcastReceiver">
<intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>

The thing is that this should be read from config.xml and added on each platform wipe.


Solution

  • You need to add a <config-file> block to your config.xml:

    <widget>
        ...
        <platform name="android">
            ...
            <config-file target="AndroidManifest.xml" parent="/manifest/application">
                <receiver android:exported="true" android:name="com.appsflyer.MultipleInstallBroadcastReceiver"/>
                <intent-filter>
                    <action android:name="com.android.vending.INSTALL_REFERRER" />
                </intent-filter>
            </config-file>
        </platform>
    </widget>
    

    Since cordova@8, <config-file> blocks are supported in config.xml (in addition to a plugin's plugin.xml).