I am trying to get a list of catchy devices programmatically in Android without using the MediaRouteActionProvider button in the SDK.
I create a MediaRouter and MediaRouteSelector as follows:
mMediaRouter = MediaRouter.getInstance(this);
mMediaRouteSelector = new MediaRouteSelector.Builder()
.addControlCategory(CastMediaControlIntent.CATEGORY_CAST)
.build();
Then I start the discovery:
mMediaRouter.addCallback(mMediaRouteSelector, mMediaRouterCallback,
MediaRouter.CALLBACK_FLAG_PERFORM_ACTIVE_SCAN);
In the onProviderAdded callback method, I seem to get 3 providers: Android, com.google.android.youtube and com.google.android.gms. Only android provides a route called Phone.
Why didn't my chromometer device appear? Other applications can see this, so I should be able to connect.
source
share