Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking.canOpenURL(url) returns false in a context where Linking.openURL(url) works #32311

Closed
BenStirrup opened this issue Oct 1, 2021 · 3 comments
Labels
API: Linking Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@BenStirrup
Copy link

BenStirrup commented Oct 1, 2021

Description

Linking.canOpenURL(url) returns false despite the fact that Linking.openURL(url) works.
Only on certain android devices, for example OnePlus 9 Pro (Android 11) and Samsung Galaxy S10 (Android 11).
In opposition, it works on a OnePlus 5 (Android 11) and a Samsung Galaxy S9 (Android 11).

React Native version:

0.64.2

Steps To Reproduce

  1. Try Linking.canOpenURL(url)
  2. If it returns false, remove it and try then Linking.openURL(url) (within a try/catch for code safety), it should work.

Expected Results

Linking.canOpenURL(url) should return true in a context where Linking.openURL(url) does open the url.

Snack, code example, screenshot, or link to a repository:

Commit that we used to fix this issue : pass-culture/pass-culture-app-native@7add481 by removing Linking.canOpenURL(url) since we cannot "trust" it.

@osamaqarem
Copy link

The issue is caused by not specifying what apps we intend to access in the AndroidManifest.xml when targeting Android 11
https://developer.android.com/training/package-visibility

Here is an example fix which registers the signature of mail apps so that Linking.canOpenURL works correctly for mailto links:
https://github.com/chirag04/react-native-mail/pull/175/files

@stale
Copy link

stale bot commented Jan 9, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@facebook facebook locked as resolved and limited conversation to collaborators Jan 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Linking Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants