startoftext
startoftext

Reputation: 3916

How can I pass other custom data to my custom VideoCastControllerActivity in Cast Companion library?

I am using CCL to implement cast functionality in my android app. CCL has a target activity (the default is VideoCastControllerActivity) that it will launch when the user clicks on the mini player or on notifications. If I have other data that I want passed to that activity what is the correct way of doing this? The data is basically just an id number.

It looks like the MediaInfo data for the media your playing gets passed to the activity in the form of a bundle. I see on that there is a JSON field to pass other custom data.

void setCustomData(org.json.JSONObject customData) { /* compiled code */ }

public org.json.JSONObject getCustomData() { /* compiled code */ }

I could convert that id number to JSON and put it in with the media info but I am not sure if I am misusing that attribute or is that what its meant to be used for? Is there another more clean approach?

Upvotes: 0

Views: 249

Answers (1)

JosephM
JosephM

Reputation: 2935

There is another way to send custom data using custom channel something like this

  Cast.CastApi.sendMessage(mApiClient, Namespace, message)
                    .setResultCallback(new ResultCallback<Status>() {

                        @Override
                        public void onResult(Status result) {
// result
  }

     });

Upvotes: 0

Related Questions