Simon Andersson
Simon Andersson

Reputation: 791

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 as https://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.

Upvotes: 3

Views: 10539

Answers (1)

Simon Andersson
Simon Andersson

Reputation: 791

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

Upvotes: 9

Related Questions