Assigned
Status Update
Comments
pe...@abc.net.au <pe...@abc.net.au> #2
there are some image for help
to...@google.com <to...@google.com> #3
hello?
pe...@abc.net.au <pe...@abc.net.au> #4
Interesting, yea we went with the manual approach in the end to get past the immediate issue but it seems to have surfaced another issue in the service that has completely stumped me. The metadata
from the MediaSession
ends up being null in rare circumstances. I believe the root cause is due to the system trying to "restart" the playback on the MediaSession so it's a pretty unrelated issue to this.
Description
Component used: androidx.media Version used: 1.2.0 Devices/Android versions reproduced on: API 21
I've set up a foreground service notification usinghttps://android-developers.googleblog.com/2020/08/playing-nicely-with-media-controls.html
NotificationCompat.MediaStyle
with an attachedMediaSessionCompat
token as described in the Android blog here:For modern devices this works without issues, the title and album art metadata (bitmap version) are correctly and automatically displayed in the notification.
For an API 21 device, the notification displays no title, and no album artwork. It instead appears to use the
smallIcon
defined on the notification builder in place of album art (screenshot attached).The metadata is constructed like so:
The Notification is built as follows:
Looking at the source for
NotificationCompat.MediaStyle
it appears that there's a divergence in behaviour between APIs 21-23 and API 24+. Given that things have shifted around a bit over the last few years into more granular androidx libraries, I'm wondering if a regression has been introduced somewhere, or if it's an issue with my usage of the library.