From the document on Firebase website: https://firebase.google.com/docs/cloud-messaging/downstream
Notifications delivered when your app is in the background. In this case, the notification is delivered to the device's system tray. A user click on a notification opens the app launcher by default.
If I need to do something when my app receives cloud message and my app is in background.
Is it possible to receive notification in custom BroadcastReceiver or Service class instead of delivering to device's system tray?
Is the only way to set "click_action" as described in https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support when user clicks the notification so that my app is able to be aware of that there's a cloud message arrived?
UPDATE:
As mentioned by tyczj, the following curl command example did this work:
curl --header "Authorization: key=$server_key" --header Content-Type:"application/json" https://fcm.googleapis.com/fcm/send -d "{\"to\": \"/topics/friendly_engage\",\"data\": {\"score\":\"123\"}}"
and the message will appear on the callack "onMessageReceived" in the Service class which extends from FirebaseMessagingService