[英]Chrome Custom tab links does not launch the app, but mobile chrome browser does
I'm trying to launch my android application through a browser link.我正在尝试通过浏览器链接启动我的 android 应用程序。
When I open the link through the chrome browser, it successfully shows the App Dialog Picker which shows the app available for the scheme like this.当我通过 chrome 浏览器打开链接时,它成功显示了应用程序对话框选择器,其中显示了可用于这样的方案的应用程序。
But when the link is opened through the Chrome Custom tab, it just redirects to the site without showing the App Dialog Picker .但是,当通过 Chrome 自定义选项卡打开链接时,它只会重定向到该站点,而不会显示 App Dialog Picker 。
I need it to launch the app or show the dialog picker when the link is opened from another app (like gmail) which opens the in-app browser and not just in the chrome browser.当从另一个应用程序(如 gmail)打开链接时,我需要它来启动应用程序或显示对话框选择器,该应用程序打开应用内浏览器,而不仅仅是在 chrome 浏览器中。
here is the current intent-filter I have.这是我当前的意图过滤器。
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
If anyone could point out would be a great help.如果有人能指出将是一个很大的帮助。 Thanks
谢谢
So if ever anyone encounters the same problem, here's what I did.因此,如果有人遇到同样的问题,这就是我所做的。 To launch your app with Chrome Custom Tabs browser, you need to make your scheme a non web-link format and make it into a custom scheme (example below).
要使用 Chrome 自定义选项卡浏览器启动您的应用程序,您需要将您的方案设为非网络链接格式并将其设为自定义方案(示例如下)。 Because apparently, Chrome Custom tabs considers web link schemes as an ordinary link therefore launching it in the browser.
因为显然,Chrome 自定义选项卡将 web 链接方案视为普通链接,因此在浏览器中启动它。
so from所以从
<intent-filter>
<data
android:scheme="http"
android:host="www.myapp.com" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
change the scheme to a custom one, that way, your app's scheme will be the only one that gets handled by the browser.将方案更改为自定义方案,这样,您的应用程序方案将是唯一由浏览器处理的方案。 This is an example link with the scheme given below ~ myapp://myapp.app (note that this link is not clickable in android apps, but you can place it in the href of the html anchor tag of your website).
这是下面给出的方案的示例链接 ~ myapp://myapp.app (请注意,此链接在 android 应用程序中不可点击,但您可以将其放在您网站的 html 锚标记的 href 中)。
<intent-filter>
<data
android:scheme="myapp"
android:host="myapp.app" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.