我使用cordova push插件创建了一个应用程序,但每次我想发送推送通知时,我必须获取该设备的注册ID并将其设置在我的APN for ios中。有没有办法自动保存ID? 这是我的apn节点服务器代码:
var apn = require('apn');
var options = { };
var token = 'Device Number';
var apnConnection = new apn.Connection(options);
var myDevice = new apn.Device(token);
var message = new apn.Notification();
message.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1hour from now.
message.badge = 1;
message.sound = "ping.aiff";
message.alert = "\uD83D\uDCE7 \u2709 You have a new message";
message.payload = {'messageFrom': 'Caroline'};
//Potentially get rid of the notification in pushNotification
apnConnection.pushNotification(message, myDevice);\
干杯
答案 0 :(得分:0)
您应该将注册ID保存在某个数据库中,然后发送给所有这些数据库。你不能“按原样”进行广播推送