Thursday, August 11, 2011

Change apple push notification view button text


We can not change the text of cancel button, but the view button text can be changed.
The payload dictionary has a field "action-loc-key", which takes the alternate text for view button.

The payload dictionary can look like,
{
    "aps": {
        "alert": {
            "body": "Bob wants to play poker",
            "action-loc-key": "PLAY"
        },
        "badge": 5,
        
    },
    "acme1": "bar",
    "acme2": [
        "bang",
        "whiz"
    ]
}

Here the text "Bob wants to play poker" will be the body of alert. and there will "cancel" and "PLAY". Here button text view will be replaced by "PLAY".

For more details on this visit apple reference document here.