Search code examples
androidgoogle-castchromecast

Chromecast SDK Android: getApplicationMetadata returns null


In my sender app I'm using

ApplicationMetadata metadata = Cast.CastApi.getApplicationMetadata(apiClient);

while

apiClient.isConnected()

returns true and my receiver app is running on the Chromecast. When I do this, the method always returns null so the metadata object is always set to null. Is there anything else I need to do for this to work?

Thanks in advance


Solution

  • There seems to be a bug there which will be addressed in the next release. Meanwhile, note that when you call Cast.CastApi.launchApplication() or Cast.CastApi.joinApplication(), you get a PendingResult object. You can set a callback on that to be notified of the result of your call; the onResult() method will be called and an ApplicationConnectionResult object will be passed to it. You can call getApplicationMetadata() on that object and that works fine (assuming you successfully launch or join an application).