How to support specific Cordova versions¶
Configuration when using a Cordova version below 7.1¶
Add namespace and platform
tags¶
Open config.xml directly under your project's directory, and edit widget
tag to add attribute xmlns:android="http://schemas.android.com/apk/res/android"
. In addition, if the tag <platform name="android">
does not exist in your config.xml, please add it under the widget
tag.
<widget xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
id="..." version="1.0.0">
...
<platform name="android">
...
</platform>
Add custom-config-file tag¶
In case of using Cordova below version 7.1, because the config-file tag does not work, please edit config.xml
following the steps below.
Add cordova-custom-config
$ cordova plugin add cordova-custom-config
The combined XML for all settings related to the cordova config-file should be combined in one
custom-config-file
tag, which then should be added by wrapping it in another<platform name="android">
tag.Replace "YOUR_PACKAGE_NAME" with your application's package name.
<custom-config-file parent="./application" target="AndroidManifest.xml"> <!-- Receiver --> <receiver android:name="io.repro.android.ReproReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND"> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="YOUR_PACKAGE_NAME" /> </intent-filter> </receiver> <!-- Notification Channel --> <meta-data android:name="io.repro.android.PushNotification.ChannelId" android:value="YOUR_CHANNEL_ID"> </meta-data> <meta-data android:name="io.repro.android.PushNotification.ChannelName" android:resource="@string/channel_name"> </meta-data> <meta-data android:name="io.repro.android.PushNotification.ChannelDescription" android:resource="@string/channel_description"> </meta-data> <meta-data android:name="io.repro.android.PushNotification.ShowBadge" android:value="true"> </meta-data> <!-- Icon and Accent Color --> <meta-data android:name="io.repro.android.PushNotification.SmallIcon" android:resource="@drawable/YOUR_ICON_ID"> </meta-data> <meta-data android:name="io.repro.android.PushNotification.AccentColor" android:resource="@color/YOUR_COLOR_ID"> </meta-data> </custom-config-file>
Create a file named
ReproStrings.xml
under the project's directory:<?xml version='1.0' encoding='utf-8'?> <resources> <string name="channel_name">YOUR_CHANNEL_NAME</string> <string name="channel_description">YOUR_CHANNEL_DESCRIPTION</string> </resources>
Add the following XML construct to config.xml inside of the
<platform name="android">
tag.<resource-file src="ReproStrings.xml" target="res/values/ReproStrings.xml" />
Settings for using Cordova Android 7.0 or lower¶
Add google-services.json
¶
Copy google-services.json
which you have downloaded from Settings for FCM (Android) to the project directory, and add the XML below into <platform name ="android">
tag of config.xml.
<resource-file src="google-services.json" target="google-services.json" />