Closed ColdLogical closed 8 years ago
When sending to a notification key, you shouldn't be using the registrationTokens
field. You should use this instead (as per the Recipients section of the README):
sender.send(message, { notificationKey: notificationKey }, function (err, response) {
if(err) console.error(err);
else console.log(response);
});
This should solve the first case!
How exactly does your code look when you are sending to the registration token directly? I don't understand why that results in an InternalServerError :smile:
As hypesystem said is right and if you get response result as 'NotRegistered' i.e) user unregistered the app ( Un installed the app) from device.
Please follow the steps properly, which mentioned on doc.
@govardhanraoganji except I am the user and I haven't uninstalled the app...
@ColdLogical please check once again you are passing correct device_id or not otherwise wise you won't get response as NotRegistered.
@govardhanraoganji In an iOS application, the only documentation I have found to generate the registration id is the FIRInstanceID.instanceID().token()
. Is there some more clear documentation you can point me to somewhere?
@ColdLogical If you won't get notification only for IOS, use 'node-apn' module to send notifications to IOS devices.
If you use 'node-apn' to send notifications to IOS device, IOS Dev no need to handle any code, notification will come directly.
Otherwise, IOS Dev should handle the logic, Here is the link. https://developers.google.com/cloud-messaging/ios/start
@hypesystem Changing the call to notificationKey
worked! Thank you so much.
Since notificationKey
is deprecated, do I instead use the to
?
@ColdLogical Great! Yeah, to
is probably what you should use :smile:
@ColdLogical great yar!, if you want to send notifications to multiple devices use below code otherwise to
sufficient.
var regTokens = []; // list of device_id's
sender.send(message, { registrationTokens: regTokens }, function (err, response) {
if(err) console.error(err);
else console.log(response);
});
Request format: https://developers.google.com/cloud-messaging/http-server-ref#send-downstream
Perhaps I am doing something wrong, as I am having a huge problem finding anything that describes the process end to end.
I am generating a registration id in an iOS application with
I push this up and on my server get it to create a notification key for the user
After that, I try sending a push notification with
The response i get is:
If i use the registration id directly instead of the notification key
Can someone maybe point me to the flaw? I cannot seem to find good documentation to find it myself.