Linking.addEventListener url never fires in android

#1

Hello,
After a lot of research I don’t find the solution to handle url parameters to my app once it’s already opened in background.
The Linking.getInitialURL() is working correctly but once my app is opened in background, if I click on a link which redirect to my custom scheme my app will open but the Linking.listener will not trigger.

Here’s the code of my app.js file

componentWillMount() {
        Linking.getInitialURL().then((url) => {
            if (url) {
                this.handleUrl(url);
            }
        });
        Linking.addEventListener('url', this.handleUrl);
    }

    componentWillUnmount() {
        Linking.removeEventListener('url', this.handleUrl);
    }

    handleUrl = (url) => {
        alert('url is : '+url);
    };

I might have seen that this feature works only for IOS or requires editing native code but it’s not specified in Expo doc. How can I achieve this in Android ?

Thanks for any help !

#2

This may be a known problem (https://github.com/expo/expo/issues/765). We landed a fix for one cause of this issue that should be part of SDK 26.

closed #3

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