getPackageName ( ) ) ) # Add custom animationsĬustom animations will make the transition from your application to the web content smoother. Make sure you let them know you are sending them users by setting the referrer when launching your Custom Tab: intent. It's usually very important for websites to track where their traffic is coming from. Make sure to provide a fallback that provides a good user experience by either opening the default browser or using your own WebView implementation. # Provide a fallback for when Custom Tabs is not installedĪlthough Custom Tabs is available for the great majority of users, there are some scenarios where a browser that supports Custom Tabs is not installed on the device or the device does not support a browser version that has Custom Tabs enabled. So, there's no need to optimize your application for those cases.
This will give the maximum speed up to the page loading process, but comes with a network and battery cost.Ĭustom Tabs is smart and knows if the user is using the phone on a metered network or if it's a low end device and pre-rendering will have a negative effect on the overall performance of the device and won't pre-fetch or pre-render on those scenarios. So, as if your user has at least a 50% likelihood of clicking on the link, call the mayLaunchUrl() method.Ĭalling mayLaunchUrl() will make Custom Tabs pre-fetch the main page with the supporting content and pre-render. Pre-rendering will make external content open instantly. The loading happens as a low priority process, meaning that it won't have any negative performance impact on your application, but will give a big performance boost when loading a link. You can save up to 700 ms when opening a link with the Custom Tabs by connecting to the service and pre-loading the browser.Ĭonnect to the Custom Tabs service on the onStart() method of the Activities you plan to launch a Custom Tab from.
# Connect to the Custom Tabs service and call warmup() This section describes a set of best practices we've found to create a good integration. Since Custom Tabs was launched, we've seen various implementations with different levels of quality.