Darshan
Darshan

Reputation: 160

Multi line title in push notification for iOS

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

Upvotes: 4

Views: 8408

Answers (1)

Tomn
Tomn

Reputation: 208

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.

Upvotes: 9

Related Questions