Upgrade Guide to FCM: Cordova¶
As announced by google, the support for GCM will end at 2019/4/11. Therefore in case you are still using GCM, it is recommended to follow the FCM transition procedure described below soon.
Transition procedure¶
Transition of a Google Cloud Platform project to the Firebase Console¶
From your Firebase Console create a new project and select your former GCM project:
Please confirm that your Google Cloud Platform project number and your Cloud Messaging sender ID are Identical. You can find your Project number under Google Cloud Platform > IAM & admin > Settings
The sender ID can be found in your Firebase Console under Settings(icon) > Cloud Messaging:
Setup FCM¶
Refer the steps in Register the App to download the
google-services.json
.Refer the steps in Generate Private Key and Register Server Key on Repro to register your Server Key.
Refer the steps in Add google-services.json to add
google-services.json
to your project.
Updating of the Repro Cordova Plugin¶
Run the following command.
$ cordova plugin rm cordova-plugin-repro
$ cordova plugin add cordova-plugin-repro
Adjust your config.xml¶
Change io.repro.android.GCMReceiver
to io.repro.ReproReceiver
like this:
<receiver
- android:name="io.repro.android.GCMReceiver"
+ 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>
Registration ID acquisition method related changes¶
The argument passed to``Repro.enablePushNotification`` as well as Repro.enablePushNotificationForAndroid
must be removed.
var app = {
...
onDeviceReady: function() {
...
- Repro.enablePushNotification(SENDER_ID);
- Repro.enablePushNotificationForAndroid(SENDER_ID);
+ Repro.enablePushNotificationForAndroid();