The reason you cannot make it work in both Carnival and Smooch is because both libraries register their own GcmListenerService, and in Android the first GcmListenerService defined in your manifest will receive all GCM messages.
I have a solution for you, based primarily on the following SO article: Multiple GCM listeners using GcmListenerService
A better solution would be to simply have one implementation of GcmListenerService and have these messages for both.
To specify your own GcmListenerService, follow the instructions in the Google Cloud Messaging Documentation .
Smooch provides the tools you need to disable GCM internal registration when you have your own.
To do this, simply call setGoogleCloudMessagingAutoRegistrationEnabled when initializing Smooch:
Settings settings = new Settings("<your_app_token>"); settings.setGoogleCloudMessagingAutoRegistrationEnabled(false); Smooch.init(this, settings);
And in your GcmRegistrationIntentService call Smooch.setGoogleCloudMessagingToken(token); with your token.
Once this is completed, you can send the GCM message to any GCM recipient that you want.
@Override public void onMessageReceived(String from, Bundle data) { final String smoochNotification = data.getString("smoochNotification"); if (smoochNotification != null && smoochNotification.equals("true")) { data.putString("from", from); Intent intent = new Intent(); intent.putExtras(data); intent.setAction("com.google.android.c2dm.intent.RECEIVE"); intent.setComponent(new ComponentName(getPackageName(), "io.smooch.core.GcmService")); GcmReceiver.startWakefulService(getApplicationContext(), intent); } }
EDIT
Starting with version 3.2.0 of Smooch, now you can more easily trigger a Smoochs notification by calling GcmService.triggerSmoochGcm in your onMessageReceived.
@Override public void onMessageReceived(String from, Bundle data) { final String smoochNotification = data.getString("smoochNotification"); if (smoochNotification != null && smoochNotification.equals("true")) { GcmService.triggerSmoochGcm(data, this); } }