5

Is it possible to set the title of a push notification? It looks like what I'm calling the title of the notification is simply the name of the associated application. I have not seen anything in the docs that mention any way to set this value. In the iOS5 notification pull-down view, emails show up with name of the sender and the subject as the title. Is this possible, or is the OS rendering email notifications in a special way?

tyler
  • 2,865
  • 1
  • 23
  • 28

2 Answers2

13

No, this is not possible. It will always use the name of the application as the title. There's no public API to set the title.

Update: This is now possible for iOS 8.2+ devices. Use the title parameter in the aps dictionary to set a custom title.

Elad Nava
  • 7,746
  • 2
  • 41
  • 61
August Lilleaas
  • 54,010
  • 13
  • 102
  • 111
9

This is possible. Apple introduced changes in payload which allows this but will be supported from iOS 8.2

Use alert key to send the title and body. Here title will be replaced by your app name and body will be the message.

-- From Apple Docs --

alert
string or dictionary

If this property is included, the system displays a standard alert or a banner, based on the user’s setting.
You can specify a string or a dictionary as the value of alert. If you specify a string, it becomes the message text of an alert with two buttons: Close and View. If the user taps View, the app launches. If you specify a dictionary, refer to Table 5-2 for descriptions of the keys of this dictionary.


title
string

A short string describing the purpose of the notification. Apple Watch displays this string as part of the notification interface. This string is displayed only briefly and should be crafted so that it can be understood quickly. This key was added in iOS 8.2.

body
string

The text of the alert message.

Reference Apple Documentation of push notification payload

santhu
  • 4,796
  • 1
  • 21
  • 29