Notification iOS

Luis_dmLuis_dm USMember ✭✭✭

How do I change the title of the remote notification?

example:

Answers

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    By specifying the "title" property in the json payload. For example:

    {
        "aps" : {
            "alert" : {
                "title" : "Game Request",
                "body" : "Bob wants to play poker",
                "action-loc-key" : "PLAY"
            }
        }
    }
    
  • Hi @DaveHunt !

    My json payload is like yours and my remote notifications always show app name as title when the app state is background or closed.

    I implemented it based on this link and used PushSharp to send notifications to APNS.

    The default format for the json payload is something like:

    
    {
       "aps": {
          "alert": {
             "title": "message title",
             "body": "message body"
          },
          "badge": 1,
          "sound": "default",
          "content-available": 1
       }
    }
    
    

    Any help would be greatly appreciated.

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    iOS only displays the title of the notification in Notification Center on iPhone/iPad. It still only shows the app name in the alert pop-up. There's no way to change that behavior.

    On Apple Watch, the alert does show the title.

  • Thanks for help @DaveHunt! Now I know this is a behavior of iOS!

Sign In or Register to comment.