Setting the title of a Push Notification?
Asked Answered
M

2

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?

Mchail answered 30/11, 2011 at 1:26 Comment(1)
Maybe it will help you. refer thisMotionless
K
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.

Knotts answered 2/12, 2011 at 10:11 Comment(1)
this is possible now. Please check my answer. @DiscursiveDiscursive
D
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

Discursive answered 28/12, 2015 at 11:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.