Closed MiguelVdev closed 9 years ago
Hi @Miguel29 - I've just pushed a new version of the package (e6f33d95d2955b7931a1e007cf8e10c754611322), which makes the regid available as this.regid
in registeredCallback
. Let me know if you have any further issues.
Thanks for the update @richsilv ! This may be a dumb question, but what's the syntax for calling the registeredCallback function? I have it like this but it doesn't seem to be firing the callback:
App = { notificationClient: new NotificationClient({ senderId: 123456789, gcmAuthorization: "xxxxx", registeredCallback: function() { console.log(this.regid); } }) };
Also, from the documentation: registeredCallback (optional) - a function to call on the client once it registers a new regid in the database and is thus ready to accept push notifications.
Does that mean that the callback function has to be client side? Thanks.
Yes, the callback is on the client side by necessity, because the regid is specific to that device - that's where the message is received from GCM, and how you know which device a given regid can be used to send a notification to.
In the background, Meteor adds the regid to that user's user doc as well, so if you wanted to have some sort of callback when new regids are registered on the server, you could run an observeChanges
on Meteor.users
to check when user docs are changed by the addition of a regid.
Hi there,
Could you help me figure out how to get the regid from registeredCallback? Would this be an argument passed by the callback function? I need the gcm regid so that I can push it to AWS SNS service.
Thanks