Sending Android notifications using node.js

I recently tried to send a push notification to my Android and ios devices. For ios, I found that a node-apn module would be used to handle this, but for android I did not come across anything like that. Any help would be greatly appreciated.

+8
javascript google-cloud-messaging
source share
2 answers

There is another alternative; android-gcm . It is very easy to use.

Example code from the documentation:

var gcm = require('android-gcm'); // initialize new androidGcm object var gcmObject = new gcm.AndroidGcm('API_KEY'); // create new message var message = new gcm.Message({ registration_ids: ['x', 'y', 'z'], data: { key1: 'key 1', key2: 'key 2' } }); // send the message gcmObject.send(message, function(err, response) {}); 
+6
source share
+2
source share

All Articles