简体   繁体   English

Chrome 自定义选项卡链接不会启动应用程序,但移动版 chrome 浏览器会

[英]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 浏览器打开链接时,它成功显示了应用程序对话框选择器,其中显示了可用于这样的方案的应用程序。

app dialog picker应用程序对话框选择器

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.

相关问题 Chrome 自定义标签不会返回应用程序 - Chrome Custom Tab does not go back to app 如何直接在应用内浏览器(Chrome 自定义选项卡)中打开外部链接,而不提示浏览器 select - How to open external links directly in in-app browser (Chrome custom tab) without getting prompt to select the browser Android-打开Chrome自定义标签,而不是启动网络浏览器PublisherAdView - Android - open Chrome custom tab instead of launch web browser PublisherAdView “ Chrome自定义标签”是否支持VectorDrawable? - Does “Chrome custom tab” support VectorDrawable? Chrome自定义标签是否要求用户下载Chrome应用? - Does Chrome Custom Tabs require the user to download the Chrome app? android浏览器无法启动应用 - android browser does not launch app Chrome 自定义标签在 chrome 中作为新标签打开而不是在应用程序内,为什么? - Chrome custom tab opens as a new tab in chrome not inside the app why? 将“ Webview”嵌入到“ Chrome应用程序”然后“部署到移动设备”是否有效? - Does embedding a “Webview” into a “Chrome App” then “Deploy To Mobile” work? 如果用户在其设备中禁用了Chrome浏览器,则Chrome自定义标签会崩溃 - Chrome custom tab crashes if chrome browser is disabled by the user in his device Android应用链接无法与Chrome自定义标签一起使用 - Android app links not working with Chrome Custom Tabs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM