Google is committed to advancing racial equity for Black communities. See how.

MediaMetadataModifier

public class MediaMetadataModifier extends Object

The class to modify the MediaMetadata of the media info in media status.

Public Constructor Summary

Public Method Summary

void
clear()
Clears all overrides.
Calendar
getDate(String key)
Returns the date override on a given key.
Double
getDouble(String key)
Returns the double override on a given key.
List<WebImage>
getImages()
Returns the list of images to override.
Integer
getInt(String key)
Returns the int override on a given key.
Integer
getMediaType()
Returns the media type to override.
String
getString(String key)
Returns the string override on a given key.
Long
getTimeMillis(String key)
Returns the time override on a given key.
boolean
hasOverrideForKey(String key)
Returns whether the metadata has override on a given key.
MediaMetadataModifier
putDate(String key, Calendar value)
Specifies a value to override in a date field.
MediaMetadataModifier
putDouble(String key, Double value)
Specifies a value to override in a double field.
MediaMetadataModifier
putInt(String key, Integer value)
Specifies a value to override in a int field.
MediaMetadataModifier
putString(String key, String value)
Specifies a value to override in a String field.
MediaMetadataModifier
putTimeMillis(String key, Long value)
Specifies a value to override in a time field, as a long in milliseconds.
MediaMetadataModifier
removeOverride(String key)
Remove the override of the given key, so that the SDK uses the default value auto-generated from MediaMetadataCompat.
MediaMetadataModifier
setImages(List<WebImage> images)
Specifies the list of images to override.
MediaMetadataModifier
setMediaType(Integer mediaType)
Sets the media type to override.

Inherited Method Summary

Public Constructors

public MediaMetadataModifier ()

Public Methods

public void clear ()

Clears all overrides.

public Calendar getDate (String key)

Returns the date override on a given key.

Parameters
key the key for the field
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a date field.
NullPointerException if there is no override for the key.

public Double getDouble (String key)

Returns the double override on a given key.

Parameters
key the key for the field
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a double field.
NullPointerException if there is no override for the key.

public List<WebImage> getImages ()

Returns the list of images to override.

public Integer getInt (String key)

Returns the int override on a given key.

Parameters
key the key for the field
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a int field.
NullPointerException if there is no override for the key.

public Integer getMediaType ()

Returns the media type to override.

public String getString (String key)

Returns the string override on a given key.

Parameters
key the key for the field
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a String field.
NullPointerException if there is no override for the key.

public Long getTimeMillis (String key)

Returns the time override on a given key.

Parameters
key the key for the field
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a time field.
NullPointerException if there is no override for the key.

public boolean hasOverrideForKey (String key)

Returns whether the metadata has override on a given key.

public MediaMetadataModifier putDate (String key, Calendar value)

Specifies a value to override in a date field.

Parameters
key the key for the field
value the new value for the field. If null, the auto-generated value from MediaMetadataCompat
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a date field.

public MediaMetadataModifier putDouble (String key, Double value)

Specifies a value to override in a double field.

Parameters
key the key for the field
value the new value for the field. If null, the auto-generated value from MediaMetadataCompat
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a double field.

public MediaMetadataModifier putInt (String key, Integer value)

Specifies a value to override in a int field.

Parameters
key the key for the field
value the new value for the field. If null, the auto-generated value from MediaMetadataCompat
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a int field.

public MediaMetadataModifier putString (String key, String value)

Specifies a value to override in a String field.

Parameters
key the key for the field
value the new value for the field. If null, the auto-generated value from MediaMetadataCompat
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a String field.

public MediaMetadataModifier putTimeMillis (String key, Long value)

Specifies a value to override in a time field, as a long in milliseconds.

Parameters
key the key for the field
value the new value for the field. If null, the auto-generated value from MediaMetadataCompat
Throws
IllegalArgumentException if the key is null or empty or refers to a predefined field which is not a time field.

public MediaMetadataModifier removeOverride (String key)

Remove the override of the given key, so that the SDK uses the default value auto-generated from MediaMetadataCompat.

public MediaMetadataModifier setImages (List<WebImage> images)

Specifies the list of images to override. If set to null, the auto-generated value from METADATA_KEY_DISPLAY_ICON_URI will be used.

public MediaMetadataModifier setMediaType (Integer mediaType)

Sets the media type to override.

The value must be one of the MEDIA_TYPE* constants of MediaMetadata, or a value greater than or equal to MEDIA_TYPE_USER for custom media types. Set to null to disable override.