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 .