Open CassioMG opened 4 years ago
Just discovered that adding a custom JSON for iOS (while creating the notification on Mixpanel Messages panel) like this solves this issue:
The app now successfully reacts to the push notification whenever it's running on Foreground or Background. But I still don't know how to make things work if the app is quit (not running).
Context
We have successfully installed
react-native-mixpanel
on our project, it works perfectly for sending events and displaying push notifications. We also have FCM push notifications installed and running perfectly for either displaying or handling the push notification payload in this same project.We are using the versions below:
This is how our AppDelegate is looking with all its push notification listeners:
Issue
We need to be able to catch and read the Mixpanel notification payload when the app is either on foreground, background or closed. But apparently none of the iOS listeners catch the notification payload UNLESS we tap on it. So the notification is just displayed on device screen and that is all. On the other hand, the listeners work perfectly with our FCM push notifications WITHOUT needing to tap on them.
Below are the automatically generated Xcode logs we get when enabling
[Mixpanel sharedInstance].enableLogging = YES;
:When receiving FCM push notification either on Foreground or Background (without needing to tap on it):
When receiving Mixpanel push notification, but ONLY AFTER tapping on it:
Proposed solution
Looks like Mixpanel push notifications only allows for notification displaying, which means it probably does not contain the latest APNS headers that need to be sent to the device in order for the device to receive the payload. You can check Apple Documentation here: https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns/
We had similar issue with FCM payload, and we solved it by using the block below including the
contentAvailable
and the correctapns-headers
:Could you please advise or update the notification payload to support the latest iOS?
Thanks!