Multi line title in push notification for iOS
Asked Answered
P

1

4

I'm integrating FCM for an app which has both iOS and Android version.

Currently, for iOS, I want to send title in multiple lines. How do I do this? I'm trying out using Firebase console to test. But nothing seems to work for me.

I tried with these

\n
<br/>
\\n
\r\n

as suggested in this post. But nothing really worked.

I basically want the first 2 lines of the notification to be in bold. Any help much appreciated. enter image description here

Predatory answered 19/7, 2017 at 17:53 Comment(0)
D
8

The 1st line in bold you see is a notification Title, the second the Subtitle, and the Content underneath (regular font).

These are properties of a notification, since iOS 10 set on UN(Mutable)NotificationContent (subtitle line is not available before).

They properties can be configured in the payload sent via APNS:

{
  "aps": {
    "alert": {
      "title": "Custom title",
      "subtitle": "Custom subtitle",
      "body": "Custom message"
    }
  }
}

Also, you can create a UserNotificationServiceExtension to update the above properties of a notification that has been received.

Dejection answered 19/7, 2017 at 20:5 Comment(2)
This will help I think. Do you know in anyway that we can get this to work with FCM?Because, from what FCM documentation says, we'll be able to send only title and body as part of "notification" key. I'm trying to implement FCM App Server that will send notification messages.Predatory
Here and here - Links for FCM documentation on payloadPredatory

© 2022 - 2024 — McMap. All rights reserved.