Created
June 16, 2015 03:44
-
-
Save rrrhys/54eef264cdf6a1f76edd to your computer and use it in GitHub Desktop.
Reset iOS badge to zero by installationId - parse.com and javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parse.Cloud.run("resetBadge", { | |
installationId: installationId | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (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