'How to detect returning from default browser in React Native

Is there any way I can detect in React Native the user is returned from the default browser?

I am going to a payment provider opening a default browser from react native. After the payment is done the user can return by clicking a button on the confirmation screen of the payment provider. The user will return with a deeplink. I can detect the deeplink so I know I have to refetch the invoices so it will show in the app the updated overview of which invoices are paid or open.

However....

The user can also after the payment return to the app with the return option in the default browser. This way the deeplink is not used but the invoices still need to be updated.

Is there any way I can detect in React Native the user is returned from the default browser? I tried to add an eventlistener with Linking.addEventListener("url", callback) . However it doesn't get triggered when returning from default browser without using the deeplink

default browser example with return button



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source