Incoming Links
suggest changeYou can detect when your app is launched from an external URL.
getInitialURL returns a promise. It does not return the URL itself.
componentDidMount() {
Linking.getInitialURL()
.then((url) => {
if (url) {
console.log('Initial url is: ' + url);
}
})
.catch(err => console.error('An error occurred', err));
}
On iOS, also listen with Linking.addEventListener('url', ...) for links that arrive while the app is already open. getInitialURL only covers a cold start.
To enable this on older iOS projects, link RCTLinking into your project. You still have to declare the URL scheme in Info.plist.
To enable this on Android, follow these steps.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents