core-android/src/main/java/com/uber/sdk/android/core/utils/CustomTabsHelper.java
public void openCustomTab(
            final Context context,
            final CustomTabsIntent customTabsIntent,
            final Uri uri,
            CustomTabFallback fallback) {
        final String packageName = getPackageNameToUse(context);

        if (packageName != null) {
            final CustomTabsServiceConnection connection = new CustomTabsServiceConnection() {
                @Override
                public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient client) {
                    client.warmup(0L); // This prevents backgrounding after redirection

                    customTabsIntent.intent.setPackage(packageName);
                    customTabsIntent.intent.setData(uri);
                    customTabsIntent.launchUrl(context, uri);
                }
                @Override
                public void onServiceDisconnected(ComponentName name) {}
            };
            CustomTabsClient.bindCustomTabsService(context, packageName, connection);
        } else if (fallback != null) {
            fallback.openUri(context, uri);
        } else {
            Log.e(UberSdk.UBER_SDK_LOG_TAG,
                    "Use of openCustomTab without Customtab support or a fallback set");
        }
    }
public void openCustomTab(
            final Context context,
            final CustomTabsIntent customTabsIntent,
            final Uri uri,
            CustomTabFallback fallback) {
        final String packageName = getPackageNameToUse(context);

        if (packageName != null) {
            final CustomTabsServiceConnection connection = new CustomTabsServiceConnection() {
                @Override
                public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient client) {
                    client.warmup(0L); // This prevents backgrounding after redirection

                    customTabsIntent.intent.setPackage(packageName);
                    customTabsIntent.intent.setData(uri);
                    customTabsIntent.launchUrl(context, uri);
                }
                @Override
                public void onServiceDisconnected(ComponentName name) {}
            };
            CustomTabsClient.bindCustomTabsService(context, packageName, connection);
        } else if (fallback != null) {
            fallback.openUri(context, uri);
        } else {
            Log.e(UberSdk.UBER_SDK_LOG_TAG,
                    "Use of openCustomTab without Customtab support or a fallback set");
        }
    }
Opens the URL on a Custom Tab if possible. Otherwise fallsback to opening it on a WebView.

@param context The host context.
@param customTabsIntent a CustomTabsIntent to be used if Custom Tabs is available.
@param uri the Uri to be opened.
@param fallback a CustomTabFallback to be used if Custom Tabs is not available.