3

I am trying to get my Media Route Selector to show both MiraCast and Chromecast devices. I have a Chromecast receiver app and also make use of the Presentation API in Android so ideally the user should only have to click the media router button and chose the device they have without even having to think about it. I was following this guide (https://developer.android.com/guide/topics/media/mediarouter.html#selector) to achieve this and in the picture it shows both a Chromecast and wireless display available in the route selector. However, after adding the control categories I still only see the Chromecast.

Here is the relevant code.

mMediaRouteSelector = new MediaRouteSelector.Builder()
                .addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO)
                .addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
                .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
                .addControlCategory(CastMediaControlIntent.categoryForCast(CAST_APP_ID))
                .build();

...

mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
                MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);

I have tried changing the callback flag also but saw no change.

EDIT:

I ended up creating a custom dialog factory for the router button and using a separate layout that includes a button that will send the user to wireless display settings. Not exactly the solution I was looking for but it appears that what I was actually trying to do is not supported.

charliebeckwith
  • 1,449
  • 11
  • 29
  • Are you actually connected to the Miracast display at the time when you are using the code? – CommonsWare Apr 08 '15 at 20:40
  • No, the miracast device would be available and if selected from the list then the device would connect to it. – charliebeckwith Apr 08 '15 at 20:43
  • AFAIK, that's not supported. – CommonsWare Apr 08 '15 at 20:44
  • So what you're saying is you don't believe there is a way to establish a connection in-app/list what devices are available? – charliebeckwith Apr 08 '15 at 21:21
  • Not for wireless displays, from what I have been able to see. – CommonsWare Apr 08 '15 at 21:24
  • @Commonsware: the image on the the docs clearly shows a Netgear Push2TV Miracast device... I wonder if you have to manually enable the Wireless Display setting in the drop down menu hidden in the top right hand corner of "Settings->Display->Cast Screen" before this works? – Jussi Kukkonen Apr 09 '15 at 13:30
  • "the image on the the docs clearly shows a Netgear Push2TV Miracast device" -- yes, but the Android device may already be connected to it. By "connected" I don't mean "using `Presentation` on it", but "the wireless display connection is made, probably showing the default mirroring". – CommonsWare Apr 09 '15 at 13:31
  • 1
    I guess it's possible but that wouldn't make any sense -- not only would they be showing a device that can't be used (according to you) but the device would also be advertizing itself as "not available" (because it's already streaming). – Jussi Kukkonen Apr 09 '15 at 13:35
  • @CommonsWare I am too curious about this. jku is making two good points and besides, why would the Media Route Dialog present an already connected Miracast device in its list ? Just to be able disconnect it ? I have tried connecting first to the miracast dongle and only then searching for devices from my code - but the dialog endlessly spins a circle without detecting anything nearby. How would one go about programamticaly connecting to a miracast device ? – kellogs Oct 30 '15 at 00:28
  • @kellogs: I am not aware that what you want is possible, sorry. – CommonsWare Oct 30 '15 at 00:34

0 Answers0