I'm using FCM to send notifications for a project in booth plattforms, iOS and Android. Following are the payloads I'm sending:
{
"to":"user_key",
"priority":"high",
"content_available":true,
"mutable_content":true,
"data":{
"body":"test"
}
}
After reading the Firebase documentation, the behaviour when sending notification and data payload through FCM is:
iOS
- You won't see banner if
notification->bodyis not defined.
Android
- If you pass
data payloadonly, it will receive data when is inbackground. - If you pass
notification_payload,system traywill handle it.
The thing is:
For Android I want to avoid to pass notification_payload in order to receive data when app is in background (in this way onMessageReceived() will be called). But then, I won´t receive notifications in iOS.
Help/Suggestions appreciated.