I am using Firebase for our messaging service in our Android app. I have researched Firebase quite a bit and I understand that whether the app if running in the foreground o
Remove the notification payload from your FCM messages in order to have the data payload delivered to the onMessageReceived method.
Read this and this carefully.
When your app is in the background, data payload delivered to the onMessageReceived method only if there is no notification payload. (Mark the words)
In case both payloads exist then system automatically handles the notification part (system tray) and your app gets the data payload in the extras of the intent of launcher Activity (after the user tap on the notification).
In order to be able to serve both platforms successfully, Android and iOS, you may have to send different FCM messages according to client's OS.