Sending android push notification through node.js

17,807

Solution 1

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) {});

Solution 2

Check these solutions for more info.

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

https://github.com/Instagram/node2dm

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

Share:
17,807
Amanda G
Author by

Amanda G

Updated on June 05, 2022

Comments

  • Amanda G
    Amanda G almost 2 years

    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.

  • Amanda G
    Amanda G over 11 years
    thanks for the information. Will this work for the new android gcm? If u know anything regarding that please do help me
  • Serdar Dogruyol
    Serdar Dogruyol over 11 years
    Probably will work for the new gcm.But you better check the docs for each one.
  • Venkatesh Voona
    Venkatesh Voona almost 8 years
    Here, registration Id's means, Where we can get ?
  • Chris Timberlake
    Chris Timberlake almost 6 years
    @VenkateshVoona - Hey, You've probably figured this out by now. But the Registration ID is the ID your app gets for that device when it registered for push notifications. You'll want to save those ID's when the App Registers itself with the Push Service.