简体   繁体   English

使用带有 Chrome 自定义选项卡的 OkHttpClient

[英]Use an OkHttpClient with Chrome Custom Tab

I'm working on an Android application.我正在开发一个 Android 应用程序。 I need to invoke a web page and I want to try Chrome Custom Tabs.我需要调用 web 页面,我想尝试 Chrome 自定义选项卡。 In my experience on Android development, I used the WebView to accomplish this task, specifying the client to use OkHttpClient.在我的Android开发经验中,我使用WebView来完成这个任务,指定客户端使用OkHttpClient。 This is useful when I need to customize the Http client (add header, set the timeout, etc).当我需要自定义 Http 客户端(添加 header,设置超时等)时,这很有用。 Is it possible to use the OkHttpClient with the Chrome Custom Tabs?是否可以将 OkHttpClient 与 Chrome 自定义选项卡一起使用?

No it is not possible to do what you are asking.不,不可能按照您的要求去做。 This is because you will be using an external application (eg Chrome, Firefox, etc), completely outside your control.这是因为您将使用完全不受您控制的外部应用程序(例如 Chrome、Firefox 等)。 With Chrome Custom Tabs you can customize the look and feel of the browser and very minor details (that you can find here ), but you cannot control how the browser will access the target URL.使用 Chrome 自定义选项卡,您可以自定义浏览器的外观和非常小的细节(您可以在此处找到),但您无法控制浏览器如何访问目标 URL。 That will be completely controlled by the browser implementing the Chrome Custom tabs functionality.这将完全由实现 Chrome 自定义标签功能的浏览器控制。

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

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