简体   繁体   English

React Native Expo - 单击链接时从 android 浏览器打开我的应用程序

[英]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 .我想在我的网站上实现一个链接,当从手机在浏览器中单击时打开我的 Android 应用程序

I can send them to Google Play from the app with我可以将它们从应用程序发送到 Google Play

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从我的网站,我可以将它们发送到带有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 Linking说我所要做的就是添加

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

to my app.json and then enter the scheme value in my browser到我的app.json ,然后在我的浏览器中输入方案值

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.当我在手机的 chrome 或三星浏览器中输入 myapp:// 时,它会将我发送到谷歌搜索。 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到你的app.json

If your app is still in development in the expo client, you should use a link such as如果您的应用程序仍在 expo 客户端开发中,则应使用链接,例如

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.这是您在运行 exp start 命令时将在 CMD 或终端中看到的链接。 Read more here at the docs在文档中阅读更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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