Open esanchezvz opened 3 years ago
@esanchezvz Please help me. What ionic-native wrapper did you use with this cordova plugin. I am working on the ionic project with this plugin. But I can not use this plugin fully without the ionic native wrapper. Thanks.
@stardevrk This plugin should be compatible with npm i @ionic-native/push
.
@stardevrk @esanchezvz to execute .on('notification')
callback, when app isn't on foreground, you should add "content-available": "1"
on notification payload. The behaviour could not be the same on iOS and Android.
Take a look here:
https://github.com/havesource/cordova-plugin-push/blob/master/docs/PAYLOAD.md#ios-behaviour
Bug Report
Disclaimer - this is not a bug report. I just need some guidance to get a feature involving this plugin to work correctly.
I'm building an app with Ionic + Cordova + Angular I and we have a feature that needs to redirect users to a specific screen when clicking on a push nootification. We are using firebase cloud messaging to send out the notifications.
Expected Behaviour
We send out a notification with a new post created and the user clicks on that notification from the tray and it should open the app + navigate to that specific screen.
Actual Behaviour
This works perfectly whenever the app is running in the foreground, but when my app is closed or in the background the event handler is not called.
Reproduce Scenario (including but not limited to)
To reproduce this you would just have to add this pluggin and send out a push notification with a payload to see that the events are not firing.
Sample Push Data Payload
I was looking through the repo and found that if I send a notification with a payload it would not trigger the
.on('notification')
event handler, but it also says that if I add thecontent-available: "1"
parameter to the payload it would trigger all events in the background. However, I can't test if by addingcontent-available
it would work or how it would behave since I don't have control over the backend (I've already told this to the backend team) but apparently it may take a while to add this for me to test. So I was wondering if you could tell me if that would be the correct approach or how should I go about getting this feature to work.I've already added deeplinks logic to handle app routing but I can't get the
.on('notification')
event to run when my app is on the background. Is there a way to do this?