We know that a Firebase notification sent using Cloud Messaging will be delivered to the notification tray and the data sent along with it would be in the extras of the intent if the app is in the background. See here.
However, I lose the data sent through the notification if the user does not click on the notification. I would like to know if there is a way I can obtain the data irrespective of whether the user clears the notification or interacts with it. I do not want to send two messages, namely one notification and one message with just the data payload which would be processed in the onMessageReceived method as firebase does not guarantee the order of delivery.