【发布时间】:2015-09-17 10:43:53
【问题描述】:
我使用 cordova 推送插件创建了一个应用程序,但是每次我想发送推送通知时,我都必须获取该设备的注册 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);\
干杯
【问题讨论】:
标签: cordova push-notification cordova-plugins