简体   繁体   中英

React Native Expo - Open my app from android browser when clicking a link

I want to implement a link on my website that opens my Android App when clicked in the browser from the phone .

I can send them to Google Play from the app with

Linking.openURL("market://details?id=com.myapp.android")

and from my website I can send them to the same page with a link ashttps://play.google.com/store/apps/details?id=com.myapp.android

But I want it to open the app itself if is already installed . Is this possible? If so, how?

EDIT

Expo Linking says all I have to do is add

{
  "expo": {
    "scheme": "myapp"
  }
}

to my app.json and then enter the scheme value in my browser

However, I tried this and then entered

myapp://

in my browser, but it just sent me to a google seach with this as keywords.

It now works.

When I enter myapp:// in the chrome or samsung browser in my phone, it sent me to a google search. However, i added an

<a href="myapp://">open app</a>

it worked flawlessly.

Note that you also have to add

{
  "expo": {
    "scheme": "myapp"
  }
}

to your app.json

If your app is still in development in the expo client, you should use a link such as

exp://76-6zc.myexpouser.my-app-name.exp.direct:80

this is the link you will see in the CMD or terminal when you run exp start command. Read more here at the docs

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