8

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.

1
  • Did you got the solution for this. I want node.js RESTful api for sending notification to mobile devices so that I can make use the services. Commented Jun 28, 2016 at 12:55

2 Answers 2

6

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) {});
Sign up to request clarification or add additional context in comments.

2 Comments

Here, registration Id's means, Where we can get ?
@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.
2

Check these solutions for more info.

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

https://github.com/Instagram/node2dm

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

2 Comments

thanks for the information. Will this work for the new android gcm? If u know anything regarding that please do help me
Probably will work for the new gcm.But you better check the docs for each one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.