1
我使用这个Ruby脚本发送推送通知:如何增加对苹果推送通知隐藏数据
APNS.host = 'gateway.push.apple.com'
APNS.port = 2195
APNS.pem = 'CERTIFICATE_PATH
APNS.pass = '56895689aA'
device_token = TOKEN
APNS.send_notification(device_token, :alert => 'Message', :badge => 1, :sound => 'beep.wav')
而且我从这样的设备(其PhoneGap的)处理它
onAPNNotification: function (event) {
var pushNotification = window.plugins.pushNotification;
if (event.alert) {
navigator.notification.alert(event.alert);
}
if (event.badge) {
console.log("Set badge on " + pushNotification);
pushNotification.setApplicationIconBadgeNumber(this.onGCMRegisterSuccess, event.badge);
}
if (event.sound) {
var snd = new Media(event.sound);
snd.play();
}
}
一切工作正常,我收到通知,但我想知道是否有隐藏数据,以便通知到达时不显示(并显示来自通知一些文本的警报)。
任何帮助将是apreciated。