Skip to main content

Chrome Custom Tabs in Android using Kotlin

Updated 1 min readMarkdown

Chrome custom tabs give apps more control over their web experience. CustomTabs is a Chrome platform component.

Chrome Custom Tabs are now generally available to all users of Chrome, on all of Chrome’s supported Android versions (Jellybean onwards).

Chrome Custom Tabs allow an app to customize how Chrome looks and feels. An app can change things like:

  • Toolbar color

  • Enter and exit animations

  • Add custom actions to the Chrome toolbar, overflow menu and bottom toolbar

Launching links in custom tabs is faster than Chrome and WebView.

Implementation:
First, add a custom tab library to the build.gradle file.

dependencies { 

        … 
        implementation 'androidx.browser:browser:1.3.0'

}

Then, start url with custom tabs in your code

val url = "https://hashnode.com/@mansivaghela"                         
val builder = CustomTabsIntent.Builder()
var customTabsIntent :CustomTabsIntent  = builder.build();
customTabsIntent.launchUrl(requireContext(), Uri.parse(url))

after this you can customize tabs based on your needs.

More information will be available in below official Chrome page:
https://developer.chrome.com/multidevice/android/customtabs

Mansi Vaghela LinkedIn Twitter Github Youtube

About the author

  • Hello, My name is Mansi. I have over 3 years of professional experience developing high-quality Android applications.

No comments yet. Be the first to comment.

More from this blog