我正在使用此Java代码发送消息
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);
我收到回复
[ messageId=0:1465322271594526%5036bc7038eb0007 ]
在我的手机上我用过
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));
});
我在这里使用this plugin但我在notification