Migration from GCM to FCM
As you may already now, Google has deprecated GCM and only supports FCM.
If you are about to update the MOCA SDK for Android from version prior 2.11.2 or earlier to version 2.12.0 or greater, please ensure that you are no longer using GCM for any other feature in your application.
Although Google still supports both APIs for versions Android 10 and before, you cannot have both GCM and FCM in the same app. If you do, it could potentially generate different push tokens (one for GCM and one for FCM), and from our observations, when that happens the GCM token gets invalidated without any warning.
Please note that the MOCA SDK does not use GCM in any way.
MOCA SDK easily integrates with FCM push notifications.
- FCM token is automatically requested if you activate this feature.
- Push notifications are automatically handled by the library.
- Tracked received push notifications with MOCA SDK.
- The tracked data can be analyzed in MOCA Analytics (Pushes, PushOpened, and more) -
remotePushNotificationsService = true
<application …> <meta-data android:name="moca.AUTOMATIC_PUSH_SETUP_ENABLED" android:value="true"/>
Integrating Push with MOCA
This receiver will handle registration process and incoming push notification messages generated by MOCA.
- Ensure you have added your Google Sender Id:
gcmSender = YOUR-GCM-SENDER-ID
<!--Optional: Include it for remote push notifications--> <!--Be careful with the space before the number--> <meta-data android:name="moca.GCM_SENDER" android:value="\ YOUR_GCM_SENDER_ID" />