We've recently updated the Google Cast SDK to version 3. With this SDK it should be possible to add support for non-cast devices by implementing getAdditionalSessionProviders() in an OptionsProvider. We have created a custom SessionProvider to return with the getAdditionalSessionProviders() method.
However, this SessionProvider is never used and it will probably only be used when a device has been discovered and selected in the selection list when the MediaRouteButton is pressed as described in the Session documentation. But we can not find a way to add our discovered non-cast device to this list. We have searched the API, the documentation and the examples that are available online, but we couldn't find how to do this. We have only found examples of older sdk versions, but these are completely different and not usable.
We would like to use this functionality to add Samsung tv's to the Google Cast list with Samsung's SmartView SDK just like the YouTube and Netflix app do.
Create a custom Media Route Provider: Here is a fake MediaRouteProvider for a custom media route. This class does nothing but publish a fake custom MediaRoute so that it can be seen and selected by the Cast SDK from MediaRouter.
You need a SessionProvider implementation for your custom session:
And a Session implementation: Here is a fake Session implementation for custom media route type. It always succeeds on start/resume/end.
In your Cast V3 sender app, specify the additional session provider:
In your Application add the MediaRouter provider:
So, I had just the same problem as you, and I found some way to make it work, but as you noted, as nothing is really documented on this topic, I am not sure it is the "right way to do it".
Here is basically what I do:
The Media Route Provider is in charge of managing your device and all related commands / communication. You can test it with a very simple app using the Media Router API. There is a github from googlesample about Media Router : Android BasicMediaRouter Sample.
In you custom Session class, you can access the MediaRouter (you got context passed in the constructor) and retrieve the current Route :
With that, you should be able to get your device if it is the currently selected one (you'll be notified in the start() method of Session), and pass commands from the Session object to your Media Route Provider, as done in the Media Route sample.