Reputation: 663
Using appcompat and mediarouter version 26.0.2 with play-services-cast-framework version 11.2.2, the default cast notification isn't showing on android Oreo devices (works fine for pre Oreo devices). This seems related to the sdk not requesting a channel for his notification.
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 didn't see any way to provide a notification channel, but maybe I'm missing something. Is someone already found a solution to this issue ?
Upvotes: 4
Views: 481
Reputation: 663
According to the bug tracker ticket, "This issue is fixed internally and fix will be available in future releases."... So wait and see !
Upvotes: 1