kaiv
kaiv

Reputation: 173

Android Google Cast Notification disable

I integrated Google cast to my Android app. All my content is playing via service with notification. When I play media using Google cast it add own notification. Is it possible to disable default google cast notification and use only own notification? Thank you.

Upvotes: 2

Views: 967

Answers (1)

kaiv
kaiv

Reputation: 173

This is great portal, you ask some question, than you answer own qustion by yourself :)

To disable cast notification needed just to pass null while for setNotificationOptions() in class CastOptionsProvider.

Complete answer:

public class CastOptionsProvider implements OptionsProvider {

    @Override
    public CastOptions getCastOptions(Context context) {

        CastMediaOptions mediaOptions = new CastMediaOptions.Builder().setNotificationOptions(null).build();
        return new CastOptions.Builder().setReceiverApplicationId(context.getString(R.string.app_id)).setCastMediaOptions(mediaOptions).build();
    }

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

Upvotes: 5

Related Questions