Setting a Push Notification Header?

Can I set the name of push notifications? It looks like I call the notification title just 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 drop-down list, emails are displayed with the name of the sender and subject as the header. Is this possible, or is the provision of OS email notifications in a special way?

+4
source share
2 answers

No, It is Immpossible. He will always use the application name as the name. There is no public API to set the header.

+11
source

It is possible. Apple has made changes to the payload, which allows this, but will be supported with iOS 8.2

Use the warning key to send the name and body. Here the name will be replaced by your application name, and the message will be the body.

- from Apple Docs -

alerts
string or dictionary

If this property is enabled, the system displays a standard warning or banner based on user settings.
You can specify a string or dictionary as a warning value. If you specify a line, it will become the text of the warning message with two buttons: Close and View. If the user clicked View, the application launches. If you specified a dictionary, refer to Table 5-2 for a description of the keys for this dictionary.


Title String

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

Body
line

The text of the warning message.

Apple Documentation Link for Push Notification Payload

+5
source

Source: https://habr.com/ru/post/1383776/


All Articles