Using the appomppat app and the mediarouter version 26.0.2 with version 11.2.2 play-services-cast-framework, the transfer notification is not displayed by default on Android Oreo devices (works great for pre Oreo devices). This seems to be due to the fact that sdk does not request a channel to notify it.
This is my CastOptionsProvider file:
public class CastOptionsProvider implements OptionsProvider {
@Override
public CastOptions getCastOptions(Context appContext) {
List<String> buttonActions = new ArrayList<>();
buttonActions.add(MediaIntentReceiver.ACTION_REWIND);
buttonActions.add(MediaIntentReceiver.ACTION_TOGGLE_PLAYBACK);
buttonActions.add(MediaIntentReceiver.ACTION_FORWARD);
buttonActions.add(MediaIntentReceiver.ACTION_STOP_CASTING);
int[] compatButtonActionsIndicies = new int[]{0, 1};
NotificationOptions notificationOptions = new NotificationOptions.Builder()
.setActions(buttonActions, compatButtonActionsIndicies)
.setSkipStepMs(30 * DateUtils.SECOND_IN_MILLIS)
.setTargetActivityClassName(ExpandedControlsActivity.class.getName())
.build();
CastMediaOptions mediaOptions = new CastMediaOptions.Builder()
.setNotificationOptions(notificationOptions)
.setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName())
.setImagePicker(new PlayImagePicker())
.build();
return new CastOptions.Builder().setReceiverApplicationId(appContext.getString(R.string.CHROMECAST_APP))
.setCastMediaOptions(mediaOptions)
.build();
}
@Override
public List<SessionProvider> getAdditionalSessionProviders(Context context) {
return null;
}
}
I have not seen a way to provide a notification channel, but maybe I am missing something. Has anyone already found a solution to this problem?
source
share