Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending android push notification through node.js

I have recently been trying to send push notification to my android and ios devices. For ios I found that node-apn module will be used for handling this,but for android I haven't come across anything of that sort. Any help will be much appreciated.

like image 519
Amanda G Avatar asked Dec 18 '12 06:12

Amanda G


2 Answers

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

Code sample from 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) {});
like image 139
Muhammad Reda Avatar answered Nov 03 '22 18:11

Muhammad Reda


Check these solutions for more info.

https://github.com/SpeCT/node-c2dm

https://github.com/Instagram/node2dm

https://npmjs.org/package/pushover.net

like image 31
Serdar Dogruyol Avatar answered Nov 03 '22 18:11

Serdar Dogruyol