그래서, 폰갭에있어, 내가 사용Phonegap PushNotification, 내 노드 push-server를 phonegap과 함께 사용하는 방법?
그래서, 내가 첫 번째 플러그인을 설치하고 난 내 전화 토큰을 얻을 수 있습니다. 그 후, 나는 내 루트 디렉토리에 노드 server.js
파일을 만든 : 내가 명령 줄에서 node server.js
내 서버를 시작하면
var apn = require('apn');
var token = "MY TOKEN";
var device = new apn.Device(token);
var notification = new apn.Notification();
notification.expiry = Math.floor(Date.now()/1000) + 3600;
notification.badge = 1;
notification.alert = "This is a Push Notification=)";
notification.payload = {'prop': 'special value'};
notification.device = device;
var options = {
gateway: 'gateway.sandbox.push.apple.com',
cert: 'CER.pem',
key: 'KEY.pem',
passphrase: 'password'
}
var apnsConnection = new apn.Connection(options);
apnsConnection.pushNotification(notification, device);
, 그래서 모든 것이 괜찮아, 내 휴대 전화에서 내 푸시 알림을 볼 수 있습니다.
내 질문에, 내 코드 (phonegap) 다른 위치에 밀어 넣기 알림을 보내야합니다. 내가 어떻게 할 수 있니?
내 server.js
이 실행 중일 때 어떻게 내 전화 갭 애플리케이션에서 다른 푸시 알림을 보낼 수 있습니까?