I'm building an iOS game with Unity and am using Firebase Cloud Messaging to handle push notifications. I'm using Gamesparks as a backend service.
At the moment I'm able to receive push notifications when the app is in the background, and tapping the notifications opens the app. However, I need to take custom actions based on the notification, and the Firebase OnMessageReceived function is not being called (at all as far as I can tell, even when the app is in the foreground).
If I understand the Firebase docs correctly here: https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages, this means that I should be using a "notification message with optional data payload". I've tried sending messages with custom data from the Firebase Console, but the OnMessageReceived function is still not being called.
I see that similar questions have been asked, but I only found answers relating to Android. So essentially, when is the OnMessageReceived function called on iOS?
Thanks!