Search code examples
androidbitmaplockscreenmediametadataretrieverandroid-mediasession

Putting bitmap on MediaSessionCompat not showing ART WORK in lockscreen ?


mediaSessionCompat.setMetadata(new MediaMetadataCompat.Builder()
                            .putString(MediaMetadataCompat.METADATA_KEY_ALBUM, trackDataNowPlaying.JukeBoxCategoryName)
                            .putString(MediaMetadataCompat.METADATA_KEY_TITLE, trackDataNowPlaying.TrackName)
                            .putLong(MediaMetadataCompat.METADATA_KEY_DURATION, Math.round(trackDataNowPlaying.Length))
                            .putBitmap(MediaMetadataCompat.METADATA_KEY_ART, resource)
                            .build());

Putting bitmap on MediaSessionCompat not showing ART WORK in lockscreen. Above code used when on track changed.


Solution

  • As far as I know the way to achieve that is through setting the Large Icon when building your notification with setLargeIcon

    You can also use the NotificationCompat.MediaStyle and define the player icons and actions you desire for the user to interact with there. Apply this style to the notification with setStyle