是否可以使用云发送带有解析推送通知的附加数据?

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

是否可以使用云将额外数据放入您的推送通知中,这些数据不会显示在您的通知栏中,但您仍然可以从通知中提取它?它看起来像这样:

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);
});

这是一个说明如何操作的教程: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();

是的,你可以。您可以向字典添加额外的数据,就像 "alert" 示例:

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);
});

您还可以添加对象 ID,您可以在收到通知后使用它来检索对象。