Last active
July 7, 2021 23:31
-
-
Save coproduto/516f9e754d9c6feed8922c0c345c595a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// React Native | |
if (Linking.canOpenURL(myURL)) { | |
Linking.openURL(myURL); | |
} else { | |
// handle app not available | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Android | |
val uriIntent = Uri.parse(myUrl).let { url -> Intent(INTENT_TYPE, url) } | |
try { | |
startActivity(intent) | |
} catch (e: ActivityNotFoundException) { | |
// handle app not available | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// iOS | |
if UIApplication.canOpenURL(myURL) { | |
UIApplication.open(myURL) | |
} else { | |
// handle app not available | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment