コード例 #1
0
  @Override
  protected Builder getCastOptionBuilder(CastDevice device) {

    Builder builder = Cast.CastOptions.builder(mSelectedCastDevice, new CastListener());
    if (isFeatureEnabled(FEATURE_DEBUGGING)) {
      builder.setVerboseLoggingEnabled(true);
    }
    return builder;
  }
コード例 #2
0
  /** Connects to the device with all callbacks and things */
  private void connectToDevice() {
    try {
      Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions.builder(this.device, this);

      this.mApiClient =
          new GoogleApiClient.Builder(this.cordova.getActivity().getApplicationContext())
              .addApi(Cast.API, apiOptionsBuilder.build())
              .addConnectionCallbacks(this)
              .addOnConnectionFailedListener(this)
              .build();

      this.mApiClient.connect();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }