Disabling Automatic Notification Display in Background/Quit State for Better Handling of Deep Links #7861
Unanswered
ZiadEmadZaki
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am working on implementing notifications in our React Native project using Firebase and Expo. We have encountered a challenge with notifications when the app is in a background or quit state.
Issue:
When a notification is received while the app is in the background or quit state, it is automatically displayed. This behavior is problematic for our use case because we include a URL (a deep link) in the notification that is supposed to route the app to a specific screen when the notification is pressed. We can read the notification data using the hooks provided by the Expo-notifications package, specifically the
useLastNotificationResponse
hook.Problem:
The
useLastNotificationResponse
hook does not work with notifications automatically displayed by React Native Firebase. However, if we add a background handler using themessaging().setBackgroundMessageHandler
function, it works as expected.Finding a solution:
To address this issue, I'm trying to disable the automatic display of notifications when the app is in the background or quit state. Instead, so that I can handle the notifications manually using the setBackgroundMessageHandler function.
Thank you for your time and consideration.
Beta Was this translation helpful? Give feedback.
All reactions