mixpanel/mixpanel-android

App server push notification not received

biodunalfet opened this issue · 2 comments

Hi there,

We've not been receiving push notifications on our app since we upgraded to the version of Mixpanel that removed GCM. The issue I noticed was that multiple services the same intent filter cannot receive the push notification. Android selects one. In my case, Mixpanel service is being prioritised over our service which has stopped us from receiving push notification sent from our server. How do we solve this?

Hi @biodunalfet - As you said, Android will only use the first service you have registered on your manifest with com.google.firebase.MESSAGING_EVENT action. If you are using multiple push providers, I suggest you update your SDK to version 5.5.1. Please, read the release notes.

The idea is that you register only one custom push receiver on your AndroidManifest.xml file and which implementation will look similar to:

public class PushProvidersHandler extends FirebaseMessagingService {
    @Override
    public void onNewToken(String s) {
        super.onNewToken(s);
        MixpanelFCMMessagingService.addToken(s);

        // Do something else with other providers here
    }

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);
        if (remoteMessage.getData().containsKey("mp_message")) {
            MixpanelFCMMessagingService.showPushNotification(getApplicationContext(), remoteMessage.toIntent());
        }

        // Do something else with other providers here
    }
}

@patedit Thanks a lot! Closing this now