ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.31k stars 206 forks source link

error: InvalidRegistration #113

Closed kvdmolen closed 9 years ago

kvdmolen commented 9 years ago

Hi,

I don't understand the RegistrationID: GCM requires a Sender ID which is the sender of the message, AND the receiver ID.

But in the example-code I only see:

// Add the registration IDs of the devices you want to send to
var registrationIds = [];
registrationIds.push('regId1');
registrationIds.push('regId2');

So that is the receiver. How can I set both the Sender ID and Receiver ID?

hypesystem commented 9 years ago

Can you refer to where the documentation mentions this sender ID?

You may be talking about the API key, which is given to the Sender on creation:

var sender = new gcm.Sender('YOUR_API_KEY_HERE');
kvdmolen commented 9 years ago

Hmm, I think you're right, GCM knows who the sender is via the API key.. Let me get back on this, thanks!

woojoo666 commented 9 years ago

Anybody know how I would find the registration ID for an android app? I'm following the Android quickstart tutorial here

woojoo666 commented 9 years ago

nevermind, its from the getRegistrationId function

hypesystem commented 9 years ago

For reference: When registering an app with GCM (https://developers.google.com/mobile/add) you get a Sender ID and an API Key. The Sender ID is used in the app to generate registration IDs. The API key is used in the server (which is what node-gcm provides).

Closing this issue.