httpNick httpNick - 1 year ago 88
Android Question

Listening for incoming links on Android with React-Native

I am able to listen and handle incoming links on IOS with react-native using the linking library:, but it shows the function for adding an event listener for a url is IOS platform specific. Are there any other ways of listening for incoming links to my app on android and handling it on the Javascript side?

Answer Source

I just got it working! You just have to follow these instructions.

Basically, add an <intent-filter> block under the existing one of your android/app/src/main/AndroidManifest.xml, containing the VIEW action, the DEFAULT and BROWSABLE categories, and at least a <data>.

Then simply rebuild and reinstall your APK (react-native run-android), that's it! Links matching your <data> blocks will now open in your app!

Now just catch this URL with Linking.getInitialURL() in the componentDidMount() of your main Javascript class!

Modification example here on Github: AndroidManifest.xml and Linking.getInitialUrl()