code: public void launchUri(@NonNull final Uri uri) {
          final Context context = this.context.get();
          if (context == null) {
              Log.v(TAG, "Custom Tab Context was no longer valid.");
              return;
          }
  
          if (customTabsOptions == null) {
              customTabsOptions = CustomTabsOptions.newBuilder().build();
          }
  
          new Thread(new Runnable() {
              @Override
              public void run() {
                  boolean available = false;
                  try {
                      available = sessionLatch.await(preferredPackage == null ? 0 : MAX_WAIT_TIME_SECONDS, TimeUnit.SECONDS);
                  } catch (InterruptedException ignored) {
                  }
                  Log.d(TAG, "Launching URI. Custom Tabs available: " + available);
  
                  final Intent intent = customTabsOptions.toIntent(context, session.get());
                  intent.setData(uri);
                  try {
                      context.startActivity(intent);
                  } catch (ActivityNotFoundException ex) {
                      Log.e(TAG, "Could not find any Browser application installed in this device to handle the intent.");
                  }
              }
          }).start();
      }
docs: Opens a Uri in a Custom Tab or Browser.
  The Custom Tab service will be given up to {@link CustomTabsController#MAX_WAIT_TIME_SECONDS} to be connected.
  If it fails to connect the Uri will be opened on a Browser.
  <p>
  In the exceptional case that no Browser app is installed on the device, this method will fail silently and do nothing.
  Please, ensure the {@link Intent#ACTION_VIEW} action can be handled before calling this method.
  
  @param uri the uri to open in a Custom Tab or Browser.