Added in API level 29

Session2Token


class Session2Token : Parcelable
kotlin.Any
   ↳ android.media.Session2Token

This API is not generally intended for third party application developers. Use the AndroidX Media2 session Library for consistent behavior across all devices.

Represents an ongoing MediaSession2 or a MediaSession2Service. If it's representing a session service, it may not be ongoing.

This may be passed to apps by the session owner to allow them to create a MediaController2 to communicate with the session.

It can be also obtained by android.media.session.MediaSessionManager.

Summary

Constants
static Int

Type for MediaSession2.

static Int

Type for MediaSession2Service.

Inherited constants
Public constructors
Session2Token(context: Context, serviceComponent: ComponentName)

Constructor for the token with type TYPE_SESSION_SERVICE.

Public methods
Int

Boolean
equals(other: Any?)

Bundle

String

String?

Int

Int

Int

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Properties
static Parcelable.Creator<Session2Token!>

Constants

TYPE_SESSION

Added in API level 29
static val TYPE_SESSION: Int

Type for MediaSession2.

Value: 0

TYPE_SESSION_SERVICE

Added in API level 29
static val TYPE_SESSION_SERVICE: Int

Type for MediaSession2Service.

Value: 1

Public constructors

Session2Token

Added in API level 29
Session2Token(
    context: Context,
    serviceComponent: ComponentName)

Constructor for the token with type TYPE_SESSION_SERVICE.

Parameters
context Context: The context. This value cannot be null.
serviceComponent ComponentName: The component name of the service. This value cannot be null.

Public methods

describeContents

Added in API level 29
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

equals

Added in API level 29
fun equals(other: Any?): Boolean
Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getExtras

Added in API level 29
fun getExtras(): Bundle
Return
Bundle extras of the token This value cannot be null.

getPackageName

Added in API level 29
fun getPackageName(): String
Return
String package name of the session This value cannot be null.

getServiceName

Added in API level 29
fun getServiceName(): String?
Return
String? service name of the session. Can be null for TYPE_SESSION.

getUid

Added in API level 29
fun getUid(): Int
Return
Int uid of the session

hashCode

Added in API level 29
fun hashCode(): Int
Return
Int a hash code value for this object.

toString

Added in API level 29
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 29
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit
Parameters
dest Parcel: The Parcel in which the object should be written. This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 29
static val CREATOR: Parcelable.Creator<Session2Token!>