Help get this topic noticed by sharing it on Twitter Twitter, Facebook Facebook, or email.
Sean O'Gorman
silly

Push Notification Custom Payload

Wondering if anyone has looked into this and weather it's possible with the Generic Push Plugin.... What I am wanting to do is push some additional data/code to the devices so I can do things like take users to specific pages or execute arbitrary code based upon the push message. A typical APNS payload would look something like this...

{"aps":{"alert":"The Arizona Rattlers are Live On Cox7 Arizona.","sound":"beep.wav"}}

But after reading the APNS protocol should support additional JSON data like my 'page' key below...

{"aps":{"alert":"The Arizona Rattlers are Live On Cox7 Arizona.","sound":"beep.wav","page":"live"}}

for testing I tried pulling the 'page' data out of the message using this code....

function onNotificationAPN(event) {
if (event.alert) {
//alert('push-notification: ' + event.alert + '');
navigator.notification.alert(event.alert);
}
if (event.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (event.badge) {
pushNotification.setApplicationIconBadgeNumber(successHandler, event.badge);
}
if (event.page) {
navigator.notification.alert(event.page);
}
}

But I don't see the alert with the custom payload.

Has anyone looked into this? Thanks as always...

Sean
1 person has
this question
+1
Reply