Don't show push notification if app is open/active/focused

Please provide the following:

  1. SDK Version: 47.0.0
  2. Platforms(Android/iOS/web/all): iOS

When I send a push notification to a device, I expect the notification to show up (notification alert) if the app is foregrounded or killed. If I am currently using the app, I expect the notification NOT to show up.

How can I achieve that with expo-notifications?

The only piece of code related to that I have today is the following:

Notifications.setNotificationHandler({
    handleNotification: async () => ({
        shouldShowAlert: true,
        shouldPlaySound: true,
        shouldSetBadge: true
    })
});

I’ve tried setting shouldShowAlert, but that didn’t fix my problem. What do I have to do to achieve my expected behavior?

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