2

I am using Parse.com to send push notifications via Cloud Code. These notifications are "send to sync" so I want them to be collapsible. Collapsible means that if a device is turned off or otherwise not receiving push notifications, that these notifications should not build up. When my phone turns on, I don't need a bunch of undelivered pushes showing up telling me to sync. All I need is one. I see no way to do this in Cloud Code. Is there a way to make your push notifications collapsible? Here is my 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);
    }
  });
});
rici
  • 234,347
  • 28
  • 237
  • 341

1 Answers1

1

Unfortunately, it doesn't look like Parse supports stackable notifications. Take a look at this answer here, from the Parse archives.

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