Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Push notification handling data in the app FCM - getInitialNotification - onNotificationOpenedApp #238

Open
0hio-creator opened this issue Jun 2, 2020 · 6 comments

Comments

@0hio-creator
Copy link

I'm using Firebase messaging and would ideally handle the payload with FCM functions.

Messaging.setBackgroundMessageHandler() gets the payload from Mixpanel

But
Messaging.getInitialNotification() & Messaging.onNotificationOpenedApp() do not

So FCM can see it when it's in the background but the notification is clicked the data is not passed to JS part of my app.

The code works with FCM generated notifications.

I am receiving Push notifications from Mixpanel and the app opens on click so I'm confident the registration aspect is working.

For Android I have this in my xml
// <service
// android:name="com.mixpanel.android.mpmetrics.MixpanelFCMMessagingService"
// android:enabled="true"
// android:exported="false">
//
//
//
//

Has any one been able to access mixpanel push notification data in their js code. Either in IOS or Android?
And what Push notification library were you using?

@bpfeiffer187
Copy link

do you have mixpanel profiles set up?

Also just a thought/offer/you and i seem to be having some issues right along similar parts of implmentating this would you be open helping each other out?

@0hio-creator
Copy link
Author

Yep and registered devices with Mixpanel so I am receiving push notifications for both IOS and Android.
Yeah I'm helping people where I can. Would really appreciate help on this specific issue.

@declanelcocks
Copy link

declanelcocks commented Jun 12, 2020

public void onMessageReceived(RemoteMessage remoteMessage) {
        Map message = remoteMessage.getData();

        super.onMessageReceived(remoteMessage);

        if (intercomPushClient.isIntercomPush(message)) {
            Log.d(TAG, "Intercom message received");
            intercomPushClient.handlePush(getApplication(), message);
        } else if (remoteMessage.getData().containsKey("mp_message")) {
            Log.d(TAG, "Mixpanel message received");
            MixpanelFCMMessagingService.showPushNotification(getApplicationContext(), remoteMessage.toIntent());
        }
    }

I have this code and am having the exact same problem. I can see the notification, but in the app firebase is not picking it up via getInitialNotification, onNotificationOpened or onNotification.

@bpfeiffer187 @0hio-creator did you find a solution this?

@bpfeiffer187
Copy link

@declanelcocks @0hio-creator nope i havent. I wouldnt mind jumping on a zoom line with you two and putting our heads together to see if we can figure it out. I would really perfer to get this working without alot of overhead, but right now i am fully setting up firebase and might even just use that short term.

I am on the eastcoast US, let me know if you two want to try that.

@abeeralshaer
Copy link

@0hio-creator I have the same problem, notification listener does not handle mixpanel notifications. Did you have any idea how this would work?

@mikehlee21
Copy link

I have exactly the same issue. I can see the push notifications coming for both iOS and Android. But when I tap on the notification, it doesn't trigger the handler. @declanelcocks did you get it working?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants