In order to use Chrome Custom Tabs, do you have to expect your users to download Chrome(Beta) separately, or is it included when you implement Chrome Custom Tabs into your application?
When there is no Chrome browser Installed, you can alternative use the CustomTabFallback if you like. Here you can implement alternative solutions for that case:
/**
* A Fallback that opens the WebviewActivity when Custom Tabs is not available
*/
public final class WebviewFallback implements CustomTabActivityHelper.CustomTabFallback {
@Override
public void openUri(final Activity activity, final Uri uri) {
final Intent intent = new Intent(activity, WebviewActivity.class);
intent.putExtra(WebviewActivity.EXTRA_URL, uri.toString());
activity.startActivity(intent);
}
}
Here i use an Activity to load the URL, which just uses an WebView,i just pass the Uri to it. It really depends what you need. So you can have multiple fallback types if you like.
For Custom Tabs to work, the user needs to have a browser that supports Custom Tabs installed.
It is already available on the production Chrome, since version 45.
Currently, Chrome is the only browser that supports it, but as it's an open protocol, other browsers are expected to support it in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With