0

I am using this Java code for sending message

Sender sender = new  Sender("AIza..................Q");

// use this to send message with payload data
Message message = new Message.Builder()
.collapseKey("message")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message", "Welcome to Push Notifications") //you can get this message on client side app
.build(); 

//Use this code to send notification message to a single device
Result result = sender.send(message,
        "eBXXXXX:XXXXXXXXXXX",
        1);

I am getting response

 [ messageId=0:1465322271594526%5036bc7038eb0007 ]

On my mobile I have used

var push = PushNotification.init({
    android: {
        senderID: "SNDER_ID"
    },
    ios: {
        alert: "true",
        badge: "true",
        sound: "true"
    },
    windows: {}
});

push.on('registration', function(data) {
    console.log("registration: "+JSON.stringify(data));
});

push.on('notification', function(data) {
  console.log("notification: "+JSON.stringify(data));
    // data.message,
    // data.title,
    // data.count,
    // data.sound,
    // data.image,
    // data.additionalData
});

push.on('error', function(e) {
    console.log("error: "+JSON.stringify(e));
});

Here I am using this plugin but I am not getting any message inside notification

Manish Kumar
  • 10,214
  • 25
  • 77
  • 147
  • Are you waiting for `deviceready` event to fire before `PushNotification.init` ? And are you registering the device with your push service before trying to send to the device? – Dawson Loudon Jun 07 '16 at 18:43
  • 'registration' is getting fired and i am getting registration id – Manish Kumar Jun 07 '16 at 18:56
  • Hey this looks similar to [this thread](http://stackoverflow.com/questions/37312340/incompatibleclasschangeerror-after-updating-to-android-build-tools-25-1-6-gcm) and it has been resolved. – ReyAnthonyRenacia Jun 08 '16 at 09:24

0 Answers0