首页 > 解决方案 > 为什么 PlayerNotificationManager 在 Android 11(R) 的 startForeground 上不显示通知?

问题描述

我正在使用带有 Exoplayer 的 PlayerNotificationManager,并且在 startForeground() 上最多可以看到 Android 10 通知托盘,但是当我升级到 Android 11 时,在我的一部手机中,媒体播放器的通知托盘停止显示。

请帮忙!!

在这里,我在 Google Pixel Now 上进行了调试:

适用于 Google Pixel android 11 但不适用于三星 G973F。为什么这不适用于三星?

标签: androidandroid-notificationsexoplayer

解决方案


在这里,我在 git ExoPlayer 上出现了问题,这是一个特定于设备的问题,所以,这里是该问题的链接,

https://github.com/google/ExoPlayer/issues/8500

将 MediaSessionConnector 与 ExoPlayer PlayerNotificationManager 和 MediaSessions 一起使用:

https://github.com/google/ExoPlayer/tree/release-v2/extensions/mediasession

这里更简单地使用了 MediaSession 和 MediaSessionConnector:

https://developer.android.com/codelabs/supporting-mediasession


推荐阅读