Linking listener interferes with Notifications ResponseReceivedListener

SDK Version: 4.8.1
Platforms(Android/iOS/web/all): Android and iOS

Hi there, I’m trying to figure out how to handle a situation I’ve run into where the Linking.addEventListener function I’ve created is superseding the Notifications.addNotificationResponseReceivedListener listener that I have set up.

On app start, I set up the following notification listener which sets the push notification payload to a variable which is global and is used by other functions, such as the login function, to navigate to specific pages within my app.

let pushNotificationOptions = {screen: null};

const handleNotification = (response: NotificationResponse) => {
  pushNotificationOptions = response?.notification?.request?.content?.data;


const login = (params) => {
   if (pushNotificationOptions.screen) {
          pushNotificationOptions = {screen: null}; //clear out value so next login is normal login

The component then uses this variable to navigate to the desired page within the app when notification is clicked. This all seems to work correctly.

However, when users reach a certain page in my app, we send them to an external website and wait for a return from that website (using deep link). So, in my component, I set up something like this:

useEffect(() => {

    Linking.addEventListener('url', (event) => {

      handleLinkedUrl(event.url).then(() => {




        (err) => {





This allows the page to return my user to the app with certain data appended as url parameters which can be scraped from the event and handled in my someAction method.

If I send a push notification to the device while this Linking event listener is active and the user clicks the push notification, the linking event listener grabs the push notification, only grabs the url from the push notification (not the payload, including which screen I want to take the user to), and proceeds to attempt the handleLinkedUrl method. However, none of my push notification code is there and I don’t have the payload to inspect to find out what to do. The push should be caught by the handleNotification method set up earlier, but it never gets there.

Does anyone know how I would solve this problem?
Thank you in advance!

Colton Young

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