3

我正在使用 cordova 和一个第三方插件,该插件在 AndroidManifest.xml 文件中缺少一个设置块。我已经从 npm 检查了 custom-config,但仍然无法弄清楚如何将以下代码从 config.xml 输入到 xml 文件中。

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

问题是这应该从 config.xml 中读取并添加到每个平台擦除中。

4

1 回答 1

3

您需要将一个<config-file>块添加到您的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>

由于cordova@8,<config-file>支持块config.xml(除了插件的plugin.xml)。

于 2018-11-27T09:23:23.180 回答