exponea / exponea-react-native-sdk

MIT License
8 stars 13 forks source link

setPushOpenedListener called when notification is received while app is in foreground #123

Closed rada closed 2 months ago

rada commented 3 months ago

Hi, we are using exponea-react-native-sdk v1.8.2 and RN 0.72.4. We've followed the documentation for push messages for iOS by copying over the exponea methods (as we can't use ExponeaRNAppDelegate). The push messages are working fine, we are able to send and receive them however when the app is in the foreground and we receive push notification with a deeplink, the deeplink is immediately resolved and app navigates to the corresponding app section. This is all happening without any user interaction.

Can you please check if this is expected behaviour? We are also using OneSignal for push notification and the deeplink there is working as expected - navigating only after user opens the notification.

FYI - We we're experiencing the same issue also in v1.8.0.

Let me know if you need to see the AppDelegate from our app.

roland-misica commented 2 months ago

Hi @rada, this is expected behavior when you implement AppDelegate according to the documentation. By default, notifications received when the app is in the foreground are not shown but are automatically handled as opened. you can change that behavior within your AppDelegate by changing the implementation of application(_:didReceiveRemoteNotification:fetchCompletionHandler:), if you suppress the call of method [Exponea handlePushNotificationOpenedWithUserInfo:userInfo];, then the notification will not be tracked as opened and deep links will be not resolved automatically. Also, this might be useful for you, if you want to show notifications when your app is in a foreground state: Show foreground notifications