Я использую Parse.com для отправки push-уведомлений через Cloud Code. Эти уведомления отправляются на синхронизацию, поэтому я хочу, чтобы они были разборными. Складываемый означает, что если устройство выключено или иным образом не получает push-уведомления, эти уведомления не должны накапливаться. Когда мой телефон включается, мне не нужна куча неподтвержденных толчков, которые показывают мне синхронизацию. Мне нужно только одно. Я не вижу возможности сделать это в Cloud Code. Есть ли способ сделать ваши push-уведомления разборными? Вот мой CloudCode.Как отправить разборчивое push-уведомление с использованием кода облака Parse.com
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);
}
});
});