FCM - Get Message Label

To send a message from the FCM backend, we have this view:

enter image description here

I want to get a message shortcut (libellé du message) from RemoteMessage . When I debug for a field, the content in the message is marked as google.cac_l , which I think is the internal field.

enter image description here

+5
source share
2 answers

First, I just wonder how your question is. But after reading the document here and playing with it, I found that:

  • You cannot get the message label on the client device, because it is just a label to display only on the firebase console.
  • To get the name on the client side, you must use Advanced options , which automatically collapses at the bottom. Using advanced options, you can also send a data payload to a client by key / value.
  • Then remoteMessage.getNotification().getBody() for the notification message body (from the text of the message / Texte du message), remoteMessage.getNotification().getTitle() for the notitifcation header (from additional options), remoteMessage.getData() for the payload data (from additional options).
+4
source

Try to get it using remoteMessage.getNotification().getTitle() . However, check if remoteMessage.getNotification() != null .

Hope this helps.

0
source

All Articles