React 本机深度链接问题
Issue with React native deep linking
我遵循了下面提到的两篇文章中的所有步骤
https://hackernoon.com/react-native-deep-linking-for-ios-and-android-d33abfba7ef3
https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e
在我的 phone 上安装该应用程序后,我尝试通过提供 URL as peopleapp://people/1 格式从浏览器打开该应用程序。浏览器没有打开应用程序,而是打开 Google 搜索以搜索上述内容。
知道如何解决这个问题吗?
请注意我使用的是Android
您的问题是由于 deeplink 在 iOS 和 Android 上的工作方式不同所致。
的确,在 iOS 上,您可以通过在浏览器中键入 link 打开深度 link,这将导致应用程序打开。
但是,要 Android 打开深度 link 您需要三件事之一,因为在浏览器中输入 link 无法打开它。
编辑配置
第一种方法完全是从您提到的第二个教程中挑选出来的。这是为了使用 Android Studio 中的编辑配置选项。
That is all we need as far as configuration goes. To test this out, open Android Studio. Open Run -> Edit Configurations and change the launch options to URL, passing in the following url: peopleapp://people/1
使用网络link
第二个选项是从嵌入网页的 URL 中获取。 URL 应按以下方式使用 href 嵌入到 a
标记中
<a href="peopleapp://people/1">click me</a>
然后浏览到该网页并单击 link。那应该打开deeplink.
深度link应用
您可以使用 Play 商店中的第三方应用程序来打开深度link。有很多可供选择。您可以随时 https://play.google.com/store/apps/details?id=com.manoj.dlt&hl=en_US 尝试一下,似乎评价不错。
我遵循了下面提到的两篇文章中的所有步骤
https://hackernoon.com/react-native-deep-linking-for-ios-and-android-d33abfba7ef3
https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e
在我的 phone 上安装该应用程序后,我尝试通过提供 URL as peopleapp://people/1 格式从浏览器打开该应用程序。浏览器没有打开应用程序,而是打开 Google 搜索以搜索上述内容。
知道如何解决这个问题吗?
请注意我使用的是Android
您的问题是由于 deeplink 在 iOS 和 Android 上的工作方式不同所致。
的确,在 iOS 上,您可以通过在浏览器中键入 link 打开深度 link,这将导致应用程序打开。
但是,要 Android 打开深度 link 您需要三件事之一,因为在浏览器中输入 link 无法打开它。
编辑配置
第一种方法完全是从您提到的第二个教程中挑选出来的。这是为了使用 Android Studio 中的编辑配置选项。
That is all we need as far as configuration goes. To test this out, open Android Studio. Open Run -> Edit Configurations and change the launch options to URL, passing in the following url:
peopleapp://people/1
使用网络link
第二个选项是从嵌入网页的 URL 中获取。 URL 应按以下方式使用 href 嵌入到 a
标记中
<a href="peopleapp://people/1">click me</a>
然后浏览到该网页并单击 link。那应该打开deeplink.
深度link应用
您可以使用 Play 商店中的第三方应用程序来打开深度link。有很多可供选择。您可以随时 https://play.google.com/store/apps/details?id=com.manoj.dlt&hl=en_US 尝试一下,似乎评价不错。