Reputation: 59
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
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:
METADATA_KEY_IS_EXPLICIT
: indicates whether the item contains explicit content. To indicate an item is explicit, use this constant as the key and the longMETADATA_VALUE_ATTRIBUTE_PRESENT
as the value.
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