Hello. I have a phonegap app that receives push notifications. I am suscribed to push-notification event, but it only fires when user clicks on notification bar, and I want to display message directly in the app when the push is received (when app is open). How I can do it? Thanks

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);
}
asked 09 Sep '15, 09:47
fjluque's gravatar image

fjluque
112

Add the following setting to your Info.plist file: "Pushwoosh_SHOW_ALERT" => "NO"

This will suppress the alert and will trigger callback automatically when push notifications arrive when the app is open.

permanent link
answered 09 Sep '15, 11:05
shader's gravatar image

shader
3.9k7

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:

×165
×111
×32

question asked: 09 Sep '15, 09:47

question was seen: 1,311 times

last updated: 09 Sep '15, 11:05