The communication between the custom tab activity and the application is done via pending intents. Build the UI using the methods of CustomTabsIntent.Builder.Create an instance of CustomTabsIntent.Builder.In this example, no UI customization is done, aside from the animations and the toolbar color. slide_out_right ) CustomTabsIntent customTabsIntent = builder. BLUE ) // Application exit animation, Chrome enter animation.īuilder. UI customization is done through the methods exposed by CustomTabsIntent.Builder.Įxample: CustomTabsIntent. This code uses the latest version of the Chrome Custom Tabs, contained in the module customtabs. Application/: Example application code, in the package.It is recommended to copy the code as-is to your project and remove the Android Support Library for Chrome Custom Tabs from the adle file. API is subject to changes and this code should only be used if you want to test the latest features. This contains code analog to the Android Support library, but with the latest version of Chrome Custom Tabs, enabling features that may still not be available on the Android Support Library. customtabs/: Code within this directory is in the package.Feel free to re-use the classes withing this module. demos/: This module contains sample implementations for Chrome Custom Tabs using the Android Support Library.This code is not required to use Custom Tabs. In particular, CustomTabsHelper can be re-used. Feel free to re-use the classes within this directory, which are only provided as a convenience. shared/: Shared code between the Application and demos modules.The code in this repository is organised in four parts: Connecting to a bound service in the target browser.Adding extras to the ACTION_VIEW intent sent to the browser. These features are enabled through two mechanisms: Providing a likely URL in advance to the browser, which may perform speculative work, speeding up page load time.Pre-warming of the Browser in the background, without stealing resources from the application.Navigation awareness: the browser delivers callbacks to the application for navigations in the Custom Tab.IntroductionĬhrome Custom Tabs provides a way for an application to customize and interact with a Chrome Activity on Android, to make it a part of the application experience, while retaining the full functionality and performance of a complete web browser. Note that this feature is in no way specific to Chrome, but slight differences may exist with other implementations. Here we assume that Chrome's implementation of Custom Tabs is used. It covers UI customization, callback setup, pre-warming and pre-fetching, and lifecycle management. This presents an example application using Custom Tabs, and a possible usage of both the intent and the background service APIs.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |