apparently it's all right but no notification is delivered.

Comments

1 comment

  • Avatar
    Lucianovweb

    my js file:

    document.addEventListener("deviceready", function() { StatusBar.overlaysWebView(false); initPushwoosh(); });

    document.addEventListener('push-notification', function(event) { var notification = event.notification; alert(notification.aps.alert); pushNotification.setApplicationIconBadgeNumber(0); });

    function initPushwoosh() {

    var pushNotification = window.plugins.pushNotification;
    
    //set push notification callback before we initialize the plugin
    document.addEventListener('push-notification', function(event) {
                       ]
                                //get the notification payload
                                var notification = event.notification;
    
                                //display alert to the user for example
                                alert(notification.aps.alert);
    
                                //clear the app badge
                                pushNotification.setApplicationIconBadgeNumber(0);
                            });
    
    //initialize the plugin
    pushNotification.onDeviceReady({pw_appid:"27FAC-FB813"});
    
    //register for pushes
    pushNotification.registerDevice(
        function(status) {
            var deviceToken = status['deviceToken'];
            console.warn('registerDevice: ' + deviceToken);
        },
        function(status) {
            console.warn('failed to register : ' + JSON.stringify(status));
            alert(JSON.stringify(['failed to register ', status]));
        }
    );
    

Please sign in to leave a comment.