You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
I love the 1.4.0 update that triggers my 'notification' handler as soon as a notification with "content-available: 1" arrives in iOS, even when the app is paused. However, for these notifications I have no way of telling if the user tapped the notification or not. Here's the scenario:
When the server sends "You have a new message in your inbox!" with content-available set, I want the app to refresh the inbox. If, and only if, the user taps this notification, I want to navigate to the inbox. Currently for this notification and with the app paused my handler is called 1-2 times. First when the notification arrives, and then possibly a second time if the user taps the notification. Both times the handler is called with the exact same data, including "foreground: false".
There's even a third case, where the app is completely closed. Then my handler isn't called as soon as the notification arrives (I know this will be implemented eventually). Later on if the user taps the notification, the app cold starts and my handler gets called once, again with the exact same data.
Given these circumstances I can't figure out a way to determine if the user actually tapped on "You have a new message in your inbox!" so the app knows to navigate to the inbox. Is there another parameter that could be sent to the notification handler, alongside "foreground: true/false"?
The text was updated successfully, but these errors were encountered:
@iggyfisk if you want to send a silent notification to iOS then you just omit the alert/title field in the notification but keep in the "content-available: 1" property. This way your on('notification') handler will be called with all your data but nothing will be put in the notification shade.
@macdonst Makes a lot of sense, I believe I'm one of the first (#80) to use your plugin that way 😄
But in this scenario I still want there to be an alert in the notification shade, so I'd have to send 2 notifications for each new message in the inbox; 1 invisible to trigger a server refresh, and 1 visible that the user can tap to navigate to the inbox. I think I'd rather hack something together with the device pause/resume events in that case, they'll give me a decent idea if my handler is triggered because of user interaction.
@iggyfisk well if you see data.additionalData.content-available is set to 1 when you run the on('notificaiton') event handler you can just assume it was already handled in the background.
I love the 1.4.0 update that triggers my 'notification' handler as soon as a notification with "content-available: 1" arrives in iOS, even when the app is paused. However, for these notifications I have no way of telling if the user tapped the notification or not. Here's the scenario:
When the server sends "You have a new message in your inbox!" with content-available set, I want the app to refresh the inbox. If, and only if, the user taps this notification, I want to navigate to the inbox. Currently for this notification and with the app paused my handler is called 1-2 times. First when the notification arrives, and then possibly a second time if the user taps the notification. Both times the handler is called with the exact same data, including "foreground: false".
There's even a third case, where the app is completely closed. Then my handler isn't called as soon as the notification arrives (I know this will be implemented eventually). Later on if the user taps the notification, the app cold starts and my handler gets called once, again with the exact same data.
Given these circumstances I can't figure out a way to determine if the user actually tapped on "You have a new message in your inbox!" so the app knows to navigate to the inbox. Is there another parameter that could be sent to the notification handler, alongside "foreground: true/false"?
The text was updated successfully, but these errors were encountered: