If im in my app and send a push it comes up in an alert box?

The header is index.html with the message under? So not a proper notification?

asked 16 Jul '14, 19:41
Mark%20Latham's gravatar image

Mark Latham
2115

I believe this is the correct functionality. If you wish to change the way the notification is displayed you can make changes to the following code.

document.addEventListener('push-notification', function(event) {
    var title = event.notification.title;
    var userData = event.notification.userdata;

    console.warn('user data: ' + JSON.stringify(userData));
    alert(title);  // CHANGE THIS LINE OF CODE
});

It sounds like you wish to add the message to the DOM of your index.html page. You can do that using code like this:

$("#parent_div").append("<p>"+title+"</p>");
permanent link
answered 24 Jul '14, 02:59
synergywdeveloper's gravatar image

synergywdeve...
31116

If using Phonegap Build:

Add to Config.xml the Plugin:

"org.apache.cordova.dialogs" version="0.2.6" />

Update PushwooshiOS.js:

document.addEventListener('push-notification', function(event) {

        //get the notification payload
        var notification = event.notification;

         //ADD the Dialogs Plugin Function
        navigator.notification.alert;

        //DISABLE the iOS Native Alert Function
                    //display alert to the user for example
        //alert(notification.aps.alert);

        //to view full push payload
        //alert(JSON.stringify(notification));

        //clear the app badge
        pushNotification.setApplicationIconBadgeNumber(0);
    }
);
permanent link
answered 12 Oct '14, 02:59
safadig's gravatar image

safadig
11

edited 12 Oct '14, 03:00

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×353
×165
×91

question asked: 16 Jul '14, 19:41

question was seen: 2,604 times

last updated: 12 Oct '14, 03:00