The reason you can't get push to work in both Carnival and Smooch is that both libraries are registering 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 off the following SO article:
Multiple GCM listeners using GcmListenerService
The best solution would be to just have one GcmListenerService implementation, and have this handle messages for both.
In order to specify your own GcmListenerService, follow the instructions from Google's Cloud Messaging Documentation.
Smooch provides the tools necessary for you to disable their internal GCM registration when you have your own.
To do so, simply call setGoogleCloudMessagingAutoRegistrationEnabled
while initializing Smooch:
Settings settings = new Settings("<your_app_token>");
settings.setGoogleCloudMessagingAutoRegistrationEnabled(false);
Smooch.init(this, settings);
And in your own GcmRegistrationIntentService
, call Smooch.setGoogleCloudMessagingToken(token);
with your token.
Once that is complete, you'll be able to pass the GCM message on to any GCM Receiver that you'd like.
@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
As of Smooch version 3.2.0, you can now more easily trigger Smooch’s 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);
}
}