Skip to content

Instantly share code, notes, and snippets.

@rrrhys
Created June 16, 2015 03:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrrhys/54eef264cdf6a1f76edd to your computer and use it in GitHub Desktop.
Save rrrhys/54eef264cdf6a1f76edd to your computer and use it in GitHub Desktop.
Reset iOS badge to zero by installationId - parse.com and javascript
Parse.Cloud.run("resetBadge", {
installationId: installationId
});
// (Deploy this to Parse Cloud Code)
Parse.Cloud.define("resetBadge", function(request, response){
var Inst = Parse.Object.extend("_Installation");
var InstQ = new Parse.Query(Inst);
InstQ.equalTo("installationId", request.params.installationId);
InstQ.find({
success: function(objs){
var row = objs[0];
row.set("badge",0);
row.save();
response.success();
},
error: function(object, error){
response.error("error.");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment