Pushwoosh / pushwoosh-phonegap-plugin

Pushwoosh PhoneGap Build Plugin
Other
109 stars 139 forks source link

[Windows Phone]- "push-notification" is triggered when the notification arrives, instead of click #244

Closed andgatjens closed 7 years ago

andgatjens commented 7 years ago

Hi,

We are using pushwoosh to sent notifications to the users, and they have been working correctly, but now we need that when the user click on those notifications, they redirect the user to a different view on the application, we tried this approach:

document.addEventListener('push-notification', function(event) {
  console.log(event);
});

According to the documentation, this function should be fired when the user clicks on the notifications, but that is not correct, it is being fired as soon as the user receives the notification, not when they click it. Could you please let me know if this is the correct approach or if we should be using something different to achieve this?

Thanks, Andres

wfhm commented 7 years ago

Hi,

The issue is confirmed, so as soon as there is be a fix rolled out we will update this thread immediately.

DimanAM commented 7 years ago

Push notifications are automatically handled in foreground therefore push-notification event is triggered as if user manually clicked on notification. To handle this specific case you check the foreground property of event.notification object provided in 'push-notification' callback.