6

I'm trying to integrate the android cast v3 into my app and can't make it work.

I did exactly what written in this google document: https://developers.google.com/cast/docs/android_sender_integrate (until the header: "Configure device discovery")

And the dialog that opened when I click on the MediaRouteButton can't find any device while the "youtube" app success to find my android-tv device.

what did I missed?

// the code of the CastOptionsProvider:
class CastOptionsProvider implements OptionsProvider {

    @Override
    public CastOptions getCastOptions(Context appContext) {
        return new CastOptions.Builder().setReceiverApplicationId(
                CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID).build();
    }

    @Override
    public List<SessionProvider> getAdditionalSessionProviders(Context context) {
        return null;
    }
}

// the code in the custom view:
mMediaRouteButton = (MediaRouteButton)findViewById(R.id.media_route_button);
    CastButtonFactory.setUpMediaRouteButton(getContext(), mMediaRouteButton);
mCastContext = CastContext.getSharedInstance(getContext());

and in the manifest (inside the application tag):

<meta-data
     android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
     android:value="com.bla-company-bla.core.cast.CastOptionsProvider"/>
7
  • Are you using a custom receiver, the Default receiver or a styled receiver?
    – Ali Naddaf
    Commented Nov 6, 2016 at 21:29
  • Using the default. Commented Nov 6, 2016 at 21:30
  • You then need show some code around setting up your CastSession, your OptionProvider and such.
    – Ali Naddaf
    Commented Nov 6, 2016 at 21:50
  • Do I have to set-up CastSession to find devices? according to the google document I mentioned in the question, you need to to declare only OptionProvider. Commented Nov 6, 2016 at 21:54
  • For discovery, OptionProvider and CastContext initialization should be enough so include your code around those areas.
    – Ali Naddaf
    Commented Nov 6, 2016 at 22:01

0

Browse other questions tagged or ask your own question.