简体   繁体   中英

How to set title for iOS push notification using pushd?

In Apple iOS documentation it is mentioned that:

alert string/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.

Now I want to set title for the push notification to be shown on iOS, I have sent the below payload:

{'data.project': {'ack': 0,
              'c': {'id': 'SOME DATA'},
              'ca': 1,
              't': 'e/user',
              'v': '1',
              'vm': 2},
 'msg': 'My message',
 'title': 'My custom title'}

The push is sent but no title is set on the mobile device. Does pushd support it? What should I do?

Use this JSON Payload for sending push notification from backend. Hope this will help you. Here, "title" is the title of push notification and "body" is the text of alert message.

{
     "registration_ids" : ["put_id_here"],
    "notification" : {
        "content_available" : true,
        "body" : "this is body",
        "title" : "this is title",
        "sound" : "default",
        "badge" : 1
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM