Closed erinwilkins closed 7 years ago
It depends on which setting you use.
<variable name="IOS_FOREGROUND_ALERT_TYPE" value="BANNER" />
<variable name="ANDROID_FOREGROUND_PUSH" value="true" />
With this set, you can listen for the push-received
notification, which is called when the app is running and can be used to handle foreground notifications. The push-notification
is still triggered, but only when clicking the banner.
You would then often implement both, push-received
for updating the UI for example (or displaying an alert, confirm or other custom dialog), and optionally push-notification
for the direct (inter)action.
Unfortunately this isn't a 100% clear from the documentation.
push-notification
event is fired when user clicks on the notification.
With
<variable name="IOS_FOREGROUND_ALERT_TYPE" value="NONE" />
<variable name="ANDROID_FOREGROUND_PUSH" value="false" />
settings (wich are default) foreground notifications are automatically handled as if user manually clicks on them. Therefore push-notification
event will be also triggered in this case.
@erinwilkins
On iOS 10.2.1 and Pushwoosh Cordova plugin 6.5 it seems that you need to click on the notification for the 'push-notification' event to be fired while the app is in the foreground
By default foreground alerts are turned off on iOS platform. However IOS_FOREGROUND_ALERT_TYPE
might appear to be undefined
in config.xml
and will be treated as BANNER
(https://github.com/Pushwoosh/pushwoosh-phonegap-plugin/issues/203). Please make sure your config.xml
is in a consistent state.
http://docs.pushwoosh.com/docs/customizing-cordova-plugin#push-notifications-in-foreground
http://docs.pushwoosh.com/docs/cordova-api-reference#section-push-notification
On iOS 10.2.1 and Pushwoosh Cordova plugin 6.5 it seems that you need to click on the notification for the 'push-notification' event to be fired while the app is in the foreground. With Android 6.0.1 the 'push-notification' event is fired and there is no notification displayed while the app is in the foreground.
The documentation doesn't seem to clear anything up. Is the 'push-notification' event supposed to be fired when the app is in the foreground?