aarnaut
aarnaut

Reputation: 557

Is it possible to send additional data with parse push notifications using cloud?

Is it possible to put extra data into your push notification using cloud, that would not show up in your notification bar but you could still pull it from the notification? It would look something like this:

Parse.Push.send({
    where : pushQuery,
    data: {
        alert : "You have a new reminder!"
        // *** HERE ***
        // extraData : someData (It would be a, String)
    }
}).then(function() {
    response.success("Push was sent successfully!")
}, function(error) {
    response.error("Push failed to send with error: " + error.message);
});

Upvotes: 3

Views: 793

Answers (2)

kRiZ
kRiZ

Reputation: 2316

Yes, you can. You can add additional data to the dictionary, just like the "alert" example:

Parse.Push.send({
where : pushQuery,
data: {
    alert : "You have a new reminder!",
    // *** HERE ***
    // extraData : someData (It would be a, String)

    // Extra data:
    title: "Some title text",
    yourMessage: "Some message text",
    objectId1: "Some object id"
}
}).then(function() {
    response.success("Push was sent successfully!")
}, function(error) {
    response.error("Push failed to send with error: " + error.message);
});

You can also add object ids which you can use to retrieve objects after receiving the notification.

Upvotes: 4

Tyler Moses
Tyler Moses

Reputation: 21

Here is a tutorial that shows what to do: http://androidbook.com/akc/display?url=DisplayNoteIMPURL&reportId=4553&ownerUserId=android

JSONObject data = getJSONDataMessageForIntent();
        ParsePush push = new ParsePush();
        push.setChannel("ch1");
        push.setData(data);
        push.sendInBackground();

Upvotes: 0

Related Questions