Skip to content

Instantly share code, notes, and snippets.

@sheng168
Created June 27, 2013 15:10
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 sheng168/5877256 to your computer and use it in GitHub Desktop.
Save sheng168/5877256 to your computer and use it in GitHub Desktop.
If you're like me and don't care about non-Google devices and would rather not have yet another background service running, you can easily send GCM notifications from CloudCode.
Parse.Cloud.httpRequest({
method: 'POST',
url: 'https://android.googleapis.com/gcm/send',
headers: {
'Authorization': 'key=' + GCM_API_KEY,
'Content-Type': 'application/json'
},
body: {
registration_ids: gcmRegIds,
data: {
// Put something here
}
},
success: function(httpResponse) {
// Do something
},
error: function(httpResponse) {
console.error('GCM Request failed' + JSON.stringify(httpResponse));
}
});
@sheng168
Copy link
Author

port 8253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment