Created
June 27, 2013 15:10
-
-
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.
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.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)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
port 8253