MoEngage Docs

Configuring GCM

Before configuring GCM please make sure General Push Configuration is completed.

Please make sure you have a completed GCM Setup before proceeding further time.

Adding GCM Dependency

By default the SDK ships with MoEngage's Firebase SDK. To use GCM add the below dependency in the app level build.gradle file.

implementation ('com.moengage:moe-android-sdk:+'){
    exclude group: 'com.moengage', module: 'moe-push-firebase'
implementation 'com.moengage:moe-push-gcm:3.2.01'


For GCM to deliver push notifications there are certain permissions mandatory in the manifest file, add them if not added already

<!-- If you have specified applicationId in build.gradle file then replace [YOUR_PACKAGE_NAME] with applicationId-->
<permission android:name="[YOUR_PACKAGE_NAME/applicationId].permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="[YOUR_PACKAGE_NAME/applicationId].permission.C2D_MESSAGE" />
<uses-permission android:name="" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Adding Listener Service

Using MoEngage SDK's Listener Service

    android:permission="" >
        <action android:name="" />
        <category android:name="[YOUR_PACKAGE_NAME/applicationId]" />
 <!-- Listener for Receiving push payload from GCM -->
    android:exported="false" >
        <action android:name="" />
        <action android:name="" />

<!-- Listener for refresh token callback -->
        <action android:name=""/>

In case you want to register for Push via MoEngage and have your own listener for receiving push payload then add only the refresh token callback listener and pass the push payload to MoEngage SDK as shown below.

Using your own listener service

In case you have multiple push providers you should have only one service in your manifest file and pass on the payload to all providers. To pass payload to MoEngage SDK use the following snippet

public class MyGCMListenerService extends GcmListenerService {

  @Override public void onMessageReceived(String from, Bundle data) {
    if( null == data)return;
    if( MoEngageNotificationUtils.isFromMoEngagePlatform(data)){
      //If the message is not sent from MoEngage it will be rejected
   PushManager.getInstance().getPushHandler().handlePushPayload(getApplicationContext(), data);
      //your logic 


When using play services version greater than 7.5, at any point your application's manifest should have only one service with intent filter and one service with intent filter If there are more than one service with either of the intent filters it could lead to poor notification delivery.

Testing Push Notification

Refer to this link to read more about how to create and test push notifications.

What's Next

Geo Fence Push

Configuring GCM

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.