january
january

Reputation: 59

Android Auto binds a list of MediaItem with subtitle

enter image description here

Have you ever try to add a tag like that.
First i thought it is an ImageSpan which is built by SpannableString then set to builder.setTitle(input: Charsequence). I already tried but not working.
Do you guys know how Spotify can do that? or am i missing something, pls correct me. Big thank

Upvotes: 0

Views: 210

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 199880

This isn't something you put into the title, artist or other field, but an explicit flag you can example on each item.

As explained in the Display additional metadata indicators for Android Auto:

The following constants can be used in both MediaItem description extras and MediaMetadata extras:

They go on to use an example:

val extras = Bundle()
extras.putLong(
    MediaConstants.METADATA_KEY_IS_EXPLICIT,
    MediaConstants.METADATA_VALUE_ATTRIBUTE_PRESENT)
// Add in other extras
val description =
    MediaDescriptionCompat.Builder()
        .setMediaId(/*...*/)
        .setTitle(resources.getString(/*...*/))
        .setExtras(extras)
        .build()
return MediaBrowserCompat.MediaItem(description, /* flags */)

Upvotes: 2

Related Questions