Question

Problems sending push notifications to android

  • 4 August 2019
  • 1 reply
  • 25 views

Badge

We are having problems sending push notifications to android - here is our current set-up:

- We've tested the FireBase Server key with other push libraries and confirmed it is valid

- The People profile has a populated and valid token in the "Android Devices" people property

- We tested the device token directly with the FireBase test message and in our server with some push libraries and the device received and showed up the push notifications

- Mixpanel shows that the message is "sent" but the device never shows the push

It is also worth noting that we are using ReactNative as our development Framework and a Plugin to use Mixpanel. However, this is our first issue -- all or our events are sent successfully, and we are able to set the device tokens too.



1 reply

Userlevel 4
Badge +3

My name is Cherise, from the Mixpanel team.

First of all, thanks a bunch for the context into the steps you have already taken and letting us know that your platform is ReactNative, it really helps with the debugging process.

Since you're able to see the message come in within the logs (but you're also able to see the message when you send it from the firebase console) I assume that the receiver you already had is taking over for the displaying part of the message.

To verify this is the case, you can create a new push message test, and in this one, add the following in the custom field (to your right on the screen when you're creating the push):

{"message": "test"}

If you can confirm that it is coming in through the logs but does not show on the device, it means that your other receiver is taking over. If that is the case, you would either want to set Mixpanel's FCM class as the sole receiver in your manifest (if you only need push notification from our service), or alternatively, you can set up one of the receivers to delegate to others. Here are some instructions: https://github.com/mixpanel/mixpanel-android/releases/tag/v5.5.1

The latter approach would allow you to receive messages from Mixpanel + the firebase console or other providers that you set.

Once you send that test, and you can confirm that the 'Message Sent' event is generated, that is a good sign that FCM accepted the push load. We only generate the event when FCM confirms the message for that device token.

If this is the case, it's definitely a receiver issue, and I imagine your FCM receiver would pick that up.

To take it one step further, you can look at your manifest, and check the receiver you're using- for example, if it is the "io.invertase.firebase.messaging.RNFirebaseMessagingService" this means that you do not use our FCM receiver.

It is definitely fine if you wish to use your own receiver (to receive messages from other sources like the Firebase console), but please note that since that is the case, you will need to modify your receiver to accept Mixpanel payloads.

What may be happening is that Mixpanel is sending the message to the device, but your receiver is not recognizing the message we send. The main thing you will want to do is make sure that your receiver looks for the body of the message in the "mp_message" key instead of "message".

A step further (which would help with having the Push Open rate be displayed in Mixpanel) is to have your receiver pass on Mixpanel messages to our receiver, and you use yours for other messages. In the release notes of our SDK we cover an example of how to achieve this: https://github.com/mixpanel/mixpanel-android/releases/tag/v5.5.1

Give it a try and let me know how it goes.


Reply