问题
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.
回答1:
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;
}
}
来源:https://stackoverflow.com/questions/60754783/android-google-cast-notification-disable