Question

I have an Android app which controls UPnP MediaRenderers, and I now want to modify it to use Chromecasts too.

As I have to mix UPnP and Chromecast and my app is not using ActionBarCompat, I can't use the Cast Companion Library, so I'm trying to integrate the Cast SDK by myself, building a custom button.

For UPnP I'm using Cyberlink library, because with the WiFiP2PManager from Android SDK I can discover devices, but it doesn't seem like I can make a full UPnP control point with it. (Please, correct me if I'm wrong!)

The problem is that I have Koushik Dutta's AllCast installed in my phone, and this app has registered a new MediaRouterProviderService, so now my UPnP renderers are shown twice: one as a renderer discovered by Cyberlink and another as a MediaRoute discovered by the Cast SDK!

I don't want to remove Cyberlink, because then my app would be dependant on having AllCast installed. But I don't want these renderers to appear twice in my UI.

How could I exclude this MediaRouterProvider from my device discovery? Is there any way to identify these duplicates and filter them?

Thanks a lot.

Was it helpful?

Solution

I've found a way to discriminate both kinds of devices. Instead of using in the MediaRouteSelector the control category MediaControlIntent.CATEGORY_REMOTE_PLAYBACK (aka "give me all the devices capable of remote playback") I now use CastMediaControlIntent.categoryForRemotePlayback() (aka "give me all the devices capable of remote playback using the default receiver application"). And now I only get Chromecasts. :)

This is only applicable to sender apps that don't want to create their own Chromecast remote app, of course.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top