Skip to content Skip to sidebar Skip to footer

Mediarouter: Detecting A Chromecast Device When Using Actionbarsherlock?

So I modified the Mediarouter source to be dependent on ActionBarSherlock rather than AppCompat. However, now the callback from MediaRouteAdapter onDeviceAvailable(...) is not bein

Solution 1:

I found a hack on how to fix this.

If you use appcompat, the cast icon will only be visible when you have a chromecast device in your network, based upon your implementation of onDeviceAvailable(...).

However, if you use ABS, the onDeviceAvailable(...) method is not called when a chromecast device is available on the network. So in order to see the cast icon, we must set it as always visible.

So the issue is that the cast icon is always visible (when you set visibility to visible or when you add it to your actionbar).

HOWEVER: The MediaRouter has different view states. One for when a cast device is available and one for when there isn't one available.

The Mediarouter library consists of drawable pngs that are the icons for when a device is available or not.

Just replace the one for which 'no route is available' with a blank resource, or anything that suits the app.

When a device is available, the correct cast icon will show, and when not available your custom resource will show (blank if the resource is a blank view).

Here are full details on how to obtain the mediarouter source code, and how to fix this: http://www.droidorbit.com/2013/10/mediarouter-and-actionbarsherlock.html

Post a Comment for "Mediarouter: Detecting A Chromecast Device When Using Actionbarsherlock?"