Linking.openURL()

I’m using Linking.openURL to open external links from a webview. This works fine on ios, but on android it doesn’t do anything. I am able to log the url that is being clicked, but Linking.openURL is not opening it.

Any ideas?

can you post your code here?
even better, if you can make an example on https://snack.expo.io/ that will help get to the bottom of this.

Hi @ljafri14,

Yes show us your code and error :wink:

What the result of =>

Linking.canOpenURL(url).then(supported => {
  if (!supported) {
    console.log('Can\'t handle url: ' + url);
  } else {
    return Linking.openURL(url);
  }
}).catch(err => console.error('An error occurred', err));

Info ==> official doc Linking

1 Like

I am having the same issue. I’m using url schemes within my app to link around from dynamicly loaded content. It works fine on ios but anytime I run Linking.openURL(‘myapp://someview/someotherview’) I get the blue Something went wrong screen with an error:

Java.net.UnknownHostException: Unable to resolve host “someview”. No address associated with hostname

when running the suggest code block above that checks if LinkingCanOpenURL → it’s passing that test and running Linking.openURL with the full url provided and then throwing the error described above.

The same url originating external to the app is working… for example if I add the same url to my run configurations it works fine.

@pukeanddie were you able to find the root cause of this problem?

Deep linking with schemes isn’t the only linking tool available to you. It is often desirable for regular HTTPS links to open your application on mobile.