2

我正在使用 Parse.com 通过 Cloud Code 发送推送通知。这些通知是“发送同步”,所以我希望它们是可折叠的。可折叠意味着如果设备已关闭或未收到推送通知,则不应建立这些通知。当我的手机打开时,我不需要出现一堆未发送的推送来告诉我同步。我只需要一个。我认为在 Cloud Code 中无法做到这一点。有没有办法让你的推送通知可折叠?这是我的 CloudCode。

Parse.Cloud.afterSave("Tagnames", function (request) {
   //Get the Customer that is pointed to in the AlarmDefinitions object.
  query = new Parse.Query("Customers");
  query.get(request.object.get("customer").id, {
    success : function (cust) {
      //We have the customer pointed to by the AlarmDefinition.
      //Create the json payload data we will send to our clients.
      console.log("Customer=" + cust.get("customer"));
      console.log("action:" + "com.jrb.scadaalarm.rcvr.UPDATE_TAGNAMES");
      //send the push so that all customers can get notified.
      Parse.Push.send({
        channels : [cust.get("customer")],
        data: {
          action: "com.jrb.scadaalarm.rcvr.UPDATE_TAGNAMES"
        }
      }, {
        success : function () {
          // Push was successful
          console.log("Push successful.");
        },
        error : function (error) {
          // Handle error
          console.error("Push failed: " + error.code + " : " + error.message);
        }
      });

      //
    },
    error : function (error) {
      console.error("Got an error " + error.code + " : " + error.message);
    }
  });
});
4

1 回答 1

1

不幸的是,Parse 似乎不支持可堆叠通知。从 Parse 档案中查看这个答案。

https://parse.com/questions/android-stack-push-notifications

于 2014-09-08T10:36:19.507 回答