Stay organized with collections
Save and categorize content based on your preferences.
OnSession2TokensChangedListener
interface OnSession2TokensChangedListener
Listens for changes to the getSession2Tokens()
. This can be added using addOnSession2TokensChangedListener(android.media.session.MediaSessionManager.OnSession2TokensChangedListener,android.os.Handler)
.
This API is not generally intended for third party application developers. Apps wanting media session functionality should use the AndroidX Media3 Session Library.
Summary
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-13 UTC.
[null,null,["Last updated 2025-03-13 UTC."],[],[],null,["# MediaSessionManager.OnSession2TokensChangedListener\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnSession2TokensChangedListener\n===============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/session/MediaSessionManager.OnSession2TokensChangedListener \"View this page in Java\") \n\n```\ninterface OnSession2TokensChangedListener\n```\n\n|--------------------------------------------------------------------------------|\n| [android.media.session.MediaSessionManager.OnSession2TokensChangedListener](#) |\n\nListens for changes to the [getSession2Tokens()](/reference/kotlin/android/media/session/MediaSessionManager#getSession2Tokens()). This can be added using [addOnSession2TokensChangedListener(android.media.session.MediaSessionManager.OnSession2TokensChangedListener,android.os.Handler)](/reference/kotlin/android/media/session/MediaSessionManager#addOnSession2TokensChangedListener(android.media.session.MediaSessionManager.OnSession2TokensChangedListener,%20android.os.Handler)).\n\nThis API is not generally intended for third party application developers. Apps wanting media session functionality should use the [AndroidX Media3 Session Library](https://developer.android.com/reference/androidx/media3/session/package-summary.html).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSession2TokensChanged](#onSession2TokensChanged(kotlin.collections.MutableList))`(`tokens:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[Session2Token](../Session2Token.html#)!\u003e`)` Called when the [getSession2Tokens()](/reference/kotlin/android/media/session/MediaSessionManager#getSession2Tokens()) is changed. |\n\nPublic methods\n--------------\n\n### onSession2TokensChanged\n\nAdded in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onSession2TokensChanged(tokens: MutableList\u003cSession2Token!\u003e): Unit\n```\n\nCalled when the [getSession2Tokens()](/reference/kotlin/android/media/session/MediaSessionManager#getSession2Tokens()) is changed.\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tokens` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[Session2Token](../Session2Token.html#)!\\\u003e: list of [Session2Token](../Session2Token.html#) This value cannot be `null`. |"]]