Stay organized with collections
Save and categorize content based on your preferences.
open class MediaCommunicationManager
Provides support for interacting with MediaSession2s
that applications have published to express their ongoing media playback state.
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-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaCommunicationManager\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nMediaCommunicationManager\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaCommunicationManager \"View this page in Java\") \n\n```\nopen class MediaCommunicationManager\n```\n\n|---|----------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaCommunicationManager](#) |\n\nProvides support for interacting with [MediaSession2s](/reference/kotlin/android/media/MediaSession2) that applications have published to express their ongoing media playback state.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| open [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\\\u003c[Session2Token](/reference/kotlin/android/media/Session2Token)!\\\u003e | [getSession2Tokens](#getSession2Tokens())`()` This API is not generally intended for third party application developers. |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getVersion](#getVersion())`()` Gets the version of this [MediaCommunicationManager](#). |\n\nPublic methods\n--------------\n\n### getSession2Tokens\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getSession2Tokens(): MutableList\u003cSession2Token!\u003e\n```\n\nThis API is not generally intended for third party application developers. Use the [AndroidX](https://developer.android.com/jetpack/androidx.html) [Media3 session Library](https://developer.android.com/media/media3/session/control-playback) for consistent behavior across all devices.\n\nGets a list of [Session2Token](/reference/kotlin/android/media/Session2Token) with type [Session2Token.TYPE_SESSION](/reference/kotlin/android/media/Session2Token#TYPE_SESSION:kotlin.Int) for the current user.\n\nAlthough this API can be used without any restriction, each session owners can accept or reject your uses of [MediaSession2](/reference/kotlin/android/media/MediaSession2).\n\n| Return ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\u003c[Session2Token](/reference/kotlin/android/media/Session2Token)!\u003e | A list of [Session2Token](/reference/kotlin/android/media/Session2Token). This value cannot be `null`. |\n\n### getVersion\n\nAdded in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getVersion(): Int\n```\n\nGets the version of this [MediaCommunicationManager](#).\n\n| Return ||\n|----------------------------------------------------------------------------|-----------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is 1 or greater |"]]