Since I started targetting Android 13 my app media notification shows controls in random order only on Samsung devices running Android 13. I know that the media notification behavior changed in Android 13 and that the notification now shows the action enabled on the mediasession. I'm adding custom controls like this
自从我开始瞄准Android 13,我的应用程序媒体通知只在运行Android 13的三星设备上以随机顺序显示控制。我知道Android 13的媒体通知行为发生了变化,通知现在显示在媒体会话上启用的操作。我正在添加这样的自定义控件
stateBuilder.addCustomAction(new PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_PREVIOUS_EPISODE, PodcastAddictApplication.getInstance().getString(R.string.previous), R.drawable.ic_previous_track_dark).build());
stateBuilder.addCustomAction(new PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_REWIND, PodcastAddictApplication.getInstance().getString(R.string.fastRewindTrackButtonContentDescription), R.drawable.ic_rewind_dark).build());
stateBuilder.addCustomAction(new PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_FASTFORWARD, PodcastAddictApplication.getInstance().getString(R.string.fastForwardButtonContentDescription), R.drawable.ic_fast_forward_dark).build());
stateBuilder.addCustomAction(new PlaybackStateCompat.CustomAction.Builder(CUSTOM_ACTION_NEXT_EPISODE, PodcastAddictApplication.getInstance().getString(R.string.next), R.drawable.ic_next_track_dark).build());
But Samsung device are ignoring this order and showing the same controls in a random order like fast forward first, followed by previous track, then play/pause button, then rewind and next track. I don't see any logic here. If anyone has any idea on how I can fix this that would be great.
但三星设备忽略了这一顺序,并以随机顺序显示相同的控件,如先快进,然后是上一首曲目,然后是播放/暂停按钮,然后是倒带和下一首曲目。我看不出这里面有什么逻辑。如果有人对我如何解决这个问题有任何想法,那就太好了。
Thanks
谢谢
更多回答
Is there a particular reason you are using custom actions for what are built in playback controls?
对于内置的回放控件,使用自定义操作有什么特殊的原因吗?
Yes because user can customize which controls are displayed and depending on this only custom controls allows selecting the order (Except of course on Samsung devices)
是的,因为用户可以自定义显示哪些控件,因此只有自定义控件允许选择顺序(当然,三星设备上的除外)
优秀答案推荐
我是一名优秀的程序员,十分优秀!