public final class

MediaSessionCompat.Token

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.legacy.MediaSessionCompat.Token

Overview

Represents an ongoing session. This may be passed to apps by the session owner to allow them to create a MediaControllerCompat to communicate with the session.

Summary

Fields
public static final <any>CREATOR

Methods
public intdescribeContents()

public booleanequals(java.lang.Object obj)

public static MediaSessionCompat.TokenfromBundle(Bundle tokenBundle)

Creates a compat Token from a bundle object.

public static MediaSessionCompat.TokenfromToken(java.lang.Object token)

Creates a compat Token from a framework object.

public VersionedParcelablegetSession2Token()

public java.lang.ObjectgetToken()

Gets the underlying framework object.

public inthashCode()

public voidsetSession2Token(VersionedParcelable session2Token)

public BundletoBundle()

public voidwriteToParcel(Parcel dest, int flags)

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Fields

public static final <any> CREATOR

Methods

public static MediaSessionCompat.Token fromToken(java.lang.Object token)

Creates a compat Token from a framework object.

This method is only supported on and later.

Parameters:

token: The framework token object.

Returns:

A compat Token for use with MediaControllerCompat.

public int describeContents()

public void writeToParcel(Parcel dest, int flags)

public int hashCode()

public boolean equals(java.lang.Object obj)

public java.lang.Object getToken()

Gets the underlying framework object.

This method is only supported on API 21+.

Returns:

The underlying object, or null if none.

public VersionedParcelable getSession2Token()

public void setSession2Token(VersionedParcelable session2Token)

public Bundle toBundle()

public static MediaSessionCompat.Token fromBundle(Bundle tokenBundle)

Creates a compat Token from a bundle object.

Parameters:

tokenBundle:

Returns:

A compat Token for use with MediaControllerCompat.