简体   繁体   中英

Issue with React native deep linking

I followed all the steps from both the articles mentioned below

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

After the app gets installed on my phone, I tried opening the app from the browser by giving the URL as peopleapp://people/1 format. Instead of opening the app, the browser opens Google search to search for the above.

Any idea, how to solve this issue ?

Please note that I am using Android

Your issue is caused by the fact the deeplinks work differently on iOS and Android.

It is true that on iOS you can open a deeplink by typing the link into the browser and it will cause the app to open.

However, for Android to open a deeplink you need to one of three things as it will not open from typing the link into the browser.

Edit Configurations

The first method is picked exactly from the second tutorial that you mentioned. This is to use the Edit Configurations options in 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

Android Studio 中的配置图片

Use a Weblink

The second option is to it from a URL that is embeded in a webpage. The URL should be embeded in an a tag using a href in the following way

<a href="peopleapp://people/1">click me</a>

You then browse to the webpage and click the link. That should open the deeplink.

Deeplink Application

You can use a third party application from the play store that will allow you to open the deeplink. There are many to choose from. You can always give https://play.google.com/store/apps/details?id=com.manoj.dlt&hl=en_US a try it seems to have good reviews.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM