Prevent push notifications to be shown in some circumstances (chat app)

I’m building a chat feature within an Expo app. When a chat message is received, a push notification in sent to other participants. Is it possible to prevent this push notification to appear if the user is already on the chat screen? (something like Whatsapp)

Thx in advance

Hey @karlas,

You’ll want to use a listener and handle it based on if it value of notification.origin is received or selected. If it’s received that means, the app is open and foregrounded. If you only want it not to show if their on the chat screen, you’ll have to handle that with whatever navigation library you’re using.



Hi @adamjnav, thanks for your help

I understand the response, but it’s not what I’m searching. As you say, when a chat notification appears, i handle it to navigate to the chat screen.

But I want is: if user is already on the chat screen, notification should not even appear. The whatsapp example: If you are having a conversation with someone, and he/she responses, notification does not appear.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.