Hi, I have implemented push notification on my iOS app using phonegap and pushwoosh and it is working fine when the app is in the background but the problem is when the app is open it is not receiving the notification nor it is firing the 'push-notification' event.

I followed this instruction for implementing pushwoosh push notification. And one thing found weird is that the following code doesn't seem to work:

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);
                        });

Does anyone know how to alert the notification inside the app? I am using Phonegap/Cordova and developing an iOS app. Thank you.

asked 29 May '14, 03:56
clintgh's gravatar image

clintgh
3115

Hello,

Just in case if anyone encounters the same issue: there is a misprint in the current version of our plugin, and the issue can be easily resolved by adding this line to the end of onDeviceReady method in the PushNotification.m:

[[NSUserDefaults standardUserDefaults] synchronize];
permanent link
answered 29 May '14, 11:20
Dmitry%20%20Dyudeev's gravatar image

Dmitry Dyudeev
3.7k7

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
×190
×165
×13

question asked: 29 May '14, 03:56

question was seen: 2,469 times

last updated: 29 May '14, 11:20