I know that there is the same question with this title but unfortunately it is not answered right and it is accepted!!! here
I want to know how I can find out a FCM message received when app is in background to do some action on message received before clicking by user. but when app is in background
As I've mentioned in the comments section, when sending a message with a
notification message payload the Android System (Notification Tray) will handle the push notification when your app is in background.
You should use a
data-only message payload, so that it will always be handled by
See the Handling Messages docs in Android for more details.