-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature request: separate the notification handler into notification-arrived and notification-clicked #428
Comments
I +1 this one as a user. Further details on this approach has already been mentioned: |
This would probably require and benefit from a 2.0 version bump, as the event API would be anew. |
You can still keep the old This way it's not a breaking change :) |
The |
@yoav-zibin Take a look at Issue #293. As of release 1.5.0 you'll be able to send a push with an alert/title and still have it call the |
Hi, I looked at #293 but it doesn't fit my use-case, because I don't want the notification to be silent. My use-case is a gaming app: the notifications are moves done in different matches (by different opponents). Suppose the app is in the background. Then I want to show ALL notifications, AND also update the app. This way, if the user clicks on one notification, the app shows the right thing for all matches (not just the notification the user clicked on). |
@yoav-zibin but with the code implemented for #293 if content-available is set to 1 with a message/title in your push notification then it shows up in the notification shade and calls the |
Thanks for all the help :) First, I didn't realize it will show a notification because the bug said "if the "content-available" property is set to "1" then force it to be a silent notification." But I still don't think it will work because I need a callback when the user clicks on the notification. See for a given notification I need two callbacks: one when it arrives (to update the state), and one when the user clicks on it (to load the correct match). If you actually call the notification handler twice (when the notification arrives, and when the user clicks on it), then it does work for me :D E.g., suppose I have two matches with opponent X and opponent Y. And both opponents made a move, so I see two notifications.
I looked at your code changes and I wasn't sure whether notification handler will be called twice in this use-case: {
title: "Test Push",
message: "Push number 1",
+ info: "super secret info",
+ content-available: "1"
} |
+1. I also need to have two callback for notifications. My use-case is a little different but having two callbacks may solve my problem. I have implemented chat feature in my application. So I only want to show the notification if the user is currently NOT in the chat window. According to me there should be a "return false" in the on('notification-arrived') handler which will NOT show the notification. If this handler "return true", it should show the notification and when clicked it will trigger on('notification-clicked') handler. Having "return false" also helps to show the notification according to the settings for the notification. There may be the case when user don't want to see some type of notifications. Please let me know your thoughts. |
Hi, i'm also looking forward for this behaviour on the notification. Any updates? Thank you |
Hi,
Right now, if I want to use background notifications, then I have to drop the alert/message&title properties:
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md#background-notifications
So either nothing is shown (background notification, and then the notification handler is called on notification-arrived) or an alert is shown (and the notification handler is called on notification-clicked).
In my use-case (and probably others would want that), I want to both show an alert and handle the notification in the background.
Currently, in order to do that, I need to send two notifications: a background one (without alert property) and another notification with the alert property. It would be great if I can do it in one notification :)
So I propose to decouple the notion of background notification from the existence of an alert property. Instead I propose to have two handlers:
The text was updated successfully, but these errors were encountered: