PlaybackStateEvent.Builder

public static final class PlaybackStateEvent.Builder
extends Object

java.lang.Object
   ↳ android.media.metrics.PlaybackStateEvent.Builder


A builder for PlaybackStateEvent

Summary

Public constructors

Builder()

Creates a new Builder.

Public methods

PlaybackStateEvent build()

Builds the instance.

PlaybackStateEvent.Builder setMetricsBundle(Bundle metricsBundle)

Sets metrics-related information that is not supported by dedicated methods.

PlaybackStateEvent.Builder setState(int value)

Sets playback state.

PlaybackStateEvent.Builder setTimeSinceCreatedMillis(long value)

Sets timestamp since the creation in milliseconds.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder ()

Creates a new Builder.

Public methods

build

Added in API level 31
public PlaybackStateEvent build ()

Builds the instance.

Returns
PlaybackStateEvent This value cannot be null.

setMetricsBundle

Added in API level 31
public PlaybackStateEvent.Builder setMetricsBundle (Bundle metricsBundle)

Sets metrics-related information that is not supported by dedicated methods.

It is intended to be used for backwards compatibility by the metrics infrastructure.

Parameters
metricsBundle Bundle: This value cannot be null.

Returns
PlaybackStateEvent.Builder This value cannot be null.

setTimeSinceCreatedMillis

Added in API level 31
public PlaybackStateEvent.Builder setTimeSinceCreatedMillis (long value)

Sets timestamp since the creation in milliseconds.

Parameters
value long: the timestamp since the creation in milliseconds. -1 indicates the value is unknown. Value is -1 or greater

Returns
PlaybackStateEvent.Builder This value cannot be null.