-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Android double on('notification') fired #828
Comments
Hi, |
@dylanvdmerwe three for three on great issue descriptions but in this case it is by design. If you send a notification with I've told people multiple times if they don't want this behaviour they should do one of the following things:
Perhaps we need better docs? |
Those suggestions make perfect sense. I think more documentation on this would be extremely beneficial. |
@macdonst You made my day! I have implemented the third option and works fine. Thank you! |
Add more docs on the process https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#overview |
@macdonst for avoiding the 'notification' fire twice when "content-available" is set to 1, im checking that if coldstart and foreground flags both are set to false it cames from a user tap on the notification center, so i skip this event. Do you think this is a valid way (and possibly another strategy) to solve the avoiding twice firing thing?
|
My previous comment was wrong. I finally also used the strategy "3 include a unique ID" and worked good. In my case i checked with the previous idPushNotification processed (i save the last idPushNotification on localStorage ) |
Hello @checo06 can you please help me with the logic of how to see if the Id already exist?, because i have the issue that my notifications duplicates. |
This thread has been automatically locked. |
Actual Behaviour
When an Android app is in the background (in memory not killed) and a push message with
content-available: 1
is received the following happens:Expected Behaviour
I do not expect the notification event to be fired twice. Or if it is going to be fired twice (once to process the data when it is received and another time if the user presses the notification) then this needs to be consistently implemented across iOS as well.
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
Android 6.0.1
What device vendor (e.g. Samsung, HTC, Sony...)
Tested on Nexus 5.
Cordova CLI version and cordova platform version
Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-beta.6
Ionic CLI Version: 2.0.0-beta.24
Ionic App Lib Version: 2.0.0-beta.14
OS:
Node Version: v5.10.1
android 5.1.1
ios 4.1.1
Plugin version
1.6.2
Sample Code that illustrates the problem
See my repo that I have put together for testing the various scenarios.
The text was updated successfully, but these errors were encountered: