简体   繁体   English

如何在我的网站上添加“在应用程序中打开”链接

[英]How to add “Open in app” link on my website

I have added support for deep links to my android app and have added the appropriate intent filters. 我添加了对指向我的Android应用程序的深层链接的支持,并添加了适当的意图过滤器。 If I click on a weblink in a browser and I support that url, a chooser will been shown with my app listed. 如果我在浏览器中单击一个Weblink,并且支持该URL,则会显示一个选择器,其中列出了我的应用程序。

But what I want now is add a html link to my website so when the users clicks in it, it opens my app (with the url sent) without showing the chooser. 但是,我现在想要的是在我的网站上添加一个html链接,这样当用户单击它时,它会打开我的应用程序(发送了url)而没有显示选择器。 But if the user doesn't have the app installed then it should open the app PlayStore page. 但是,如果用户未安装应用程序,则应打开应用程序PlayStore页面。

Please do you know how I could do that? 请您知道我该怎么做吗?

you should Try to open it like myapp://returnApp/?status=1 (add trailing slash character). 您应该尝试像myapp:// returnApp /?status = 1(添加尾部斜杠字符)一样打开它。 This is happens because path parameter is defined with default value of /. 发生这种情况是因为path参数定义为默认值/。

Unfortunately, you can't match exactly for empty string. 不幸的是,您不能完全匹配空字符串。 As documentation states: 如文档所述:

Note : - The path part of a URI which must begin with a /.

you really in need to start app with exactly url myapp://returnApp?status=1 you can add android:pathPattern=".*" parameter to your data clause like 您确实需要使用完全正确的网址myapp:// returnApp?status = 1启动应用程序,可以将android:pathPattern =“。*”参数添加到数据子句中,例如

  <intent-filter>

  <data android:host="returnApp" android:scheme="myapp"  android:pathPattern=".*"></data>
  </intent-filter>

Intent filter with data android:pathPattern=".*" will match for any paths including empty one. 数据为android:pathPattern =“。*”的Intent过滤器将匹配所有路径,包括空路径。

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

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