Ryan
Ryan

Reputation: 544

How to set subtitle/subtext for FCM push notifications?

This is what I mean by subtitle/subtext, the text that says "This is a subtitle" beside the app name: enter image description here

I can't figure out how to do this with FCM. According to this link: https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref I can set "subtitle" but that is only for iOS. Is this possible to set this for Android with FCM? Because my screenshot shows it's possible for android apps to show a subtitle/subtext next to the app name for push notifications and I know WhatsApp does this so I'd assume it's possible. Thanks

Upvotes: 1

Views: 1794

Answers (1)

aqwert
aqwert

Reputation: 10789

What you need to use is the summaryText key. I have not tried this and by the looks the OS decides when this should be displayed. I cannot say this will be displayed for all messages or only grouped ones.

{
    "notification": {
       "title": "This is a title",
       "body": "Sample message",
       "summaryText": "This is a subtitle"
    }
}

Upvotes: 1

Related Questions