Push notification using phonegap-cordova push plugin and pushwoosh.com

I tested sending push notifications using cordova-1.8.1.js and the push plugin along with pushwoosh.com and it works as it should. I followed this guide: http://www.pushwoosh.com/programming-push-notification/push-notification-sdk-integration-for-phonegap/

A push notification is sent to my iPhone and plays a sound and shows a notification when the phone and application are closed, fine! But if I open the phone when the notification is visible, the application will open as it should ... but the warning that is displayed says: alert "push-notification", "{\ aps \": \ sound \ ": \" default \ ", \" alert \ ": \" and then the message .... \ "}}"

  • So, what's wrong, should he write a message only in an alert, and not in the rest?

Also, if I delete the application using the "home" button and run it again, I get another warning "registerDevice", "type": "7" ..... and so on. 2. How can I leave this?

Any input caused, thanks!

+5
source share
1 answer

The problem is resolved. Use this and it will show the message only in a warning and nothing more.

document.addEventListener('push-notification', function(event) {
    //console.warn('push-notification!: ' + event.notification);
    //navigator.notification.alert(JSON.stringify(['push-notification1!', event.notification]));
    var notification = JSON.parse(event.notification);
    navigator.notification.alert(notification.aps.alert);
    //pushNotification.setApplicationIconBadgeNumber(0);
    pushNotification.setApplicationIconBadgeNumber(0);
    });
+8
source

All Articles