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
This is a question rather than an issue. TL;DR - In application:didReceiveRemoteNotification I want to identify when the callback was triggered by user tapping the notification vs. the callback being called by the OS upon arrival of a notification.
Suppose you implement email client application. When a new mail is received, a notification should be displayed, and the app should pull the new mail ASAP. When the user taps the notification in the notification center, the app should display the new mail. However, if he opens the application directly (not through the notification) he should see the list of mails already updated with the latest data.
Ideally, the app would have a callback called upon arrival of a notification with {content-available:1} for updating the data, and another callback when the user clicks the notification.
However, if the app implements application:didReceiveRemoteNotification:fetchCompletionHandler: the same callback might be called twice - once immediately when the notification arrives, and again if the user clicks the notification in the notification center.
So, when the callback is triggered, how should the app know if it should navigate to the new mail (when the user taps the notification) or fetch the data (called by the system)?
I tried querying the applicationState. This doesn't help as when the user opens the control center and a notification is received (but not tapped), the application is in inactive state, same as it is when the user taps the notification.
The text was updated successfully, but these errors were encountered:
Hi,
This is a question rather than an issue.
TL;DR - In application:didReceiveRemoteNotification I want to identify when the callback was triggered by user tapping the notification vs. the callback being called by the OS upon arrival of a notification.
Suppose you implement email client application. When a new mail is received, a notification should be displayed, and the app should pull the new mail ASAP. When the user taps the notification in the notification center, the app should display the new mail. However, if he opens the application directly (not through the notification) he should see the list of mails already updated with the latest data.
Ideally, the app would have a callback called upon arrival of a notification with {content-available:1} for updating the data, and another callback when the user clicks the notification.
However, if the app implements application:didReceiveRemoteNotification:fetchCompletionHandler: the same callback might be called twice - once immediately when the notification arrives, and again if the user clicks the notification in the notification center.
So, when the callback is triggered, how should the app know if it should navigate to the new mail (when the user taps the notification) or fetch the data (called by the system)?
I tried querying the applicationState. This doesn't help as when the user opens the control center and a notification is received (but not tapped), the application is in inactive state, same as it is when the user taps the notification.
The text was updated successfully, but these errors were encountered: