Stay organized with collections
Save and categorize content based on your preferences.
public
static
interface
MediaSessionManager.OnMediaKeyEventSessionChangedListener
android.media.session.MediaSessionManager.OnMediaKeyEventSessionChangedListener
|
Listener to receive changes in the media key event session, which would receive a media key
event unless specified.
Summary
Public methods
public abstract void onMediaKeyEventSessionChanged (String packageName,
MediaSession.Token sessionToken)
Called when the media key session is changed to the given media session. The key event
session is the media session which would receive key event by default, unless the caller
has specified the target.
The session token can be null
if the media button session is unset. In that case,
packageName will return the package name of the last session's media button receiver, or
an empty string if the last session didn't set a media button receiver.
Parameters |
packageName |
String : The package name of the component that will receive the media key
event. Can be empty.
This value cannot be null . |
sessionToken |
MediaSession.Token : The media session's token. Can be null . |
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,["# MediaSessionManager.OnMediaKeyEventSessionChangedListener\n\nAdded in [API level 33](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nMediaSessionManager.OnMediaKeyEventSessionChangedListener\n=========================================================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/media/session/MediaSessionManager.OnMediaKeyEventSessionChangedListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nMediaSessionManager.OnMediaKeyEventSessionChangedListener\n`\n\n\n`\n\n\n`\n\n|---------------------------------------------------------------------------------|\n| android.media.session.MediaSessionManager.OnMediaKeyEventSessionChangedListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nListener to receive changes in the media key event session, which would receive a media key\nevent unless specified.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onMediaKeyEventSessionChanged](/reference/android/media/session/MediaSessionManager.OnMediaKeyEventSessionChangedListener#onMediaKeyEventSessionChanged(java.lang.String,%20android.media.session.MediaSession.Token))`(`[String](/reference/java/lang/String)` packageName, `[MediaSession.Token](/reference/android/media/session/MediaSession.Token)` sessionToken) ` Called when the media key session is changed to the given media session. |\n\nPublic methods\n--------------\n\n### onMediaKeyEventSessionChanged\n\nAdded in [API level 33](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onMediaKeyEventSessionChanged (String packageName, \n MediaSession.Token sessionToken)\n```\n\nCalled when the media key session is changed to the given media session. The key event\nsession is the media session which would receive key event by default, unless the caller\nhas specified the target.\n\n\nThe session token can be `null` if the media button session is unset. In that case,\npackageName will return the package name of the last session's media button receiver, or\nan empty string if the last session didn't set a media button receiver.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `packageName` | `String`: The package name of the component that will receive the media key event. Can be empty. This value cannot be `null`. \u003cbr /\u003e |\n| `sessionToken` | `MediaSession.Token`: The media session's token. Can be `null`. \u003cbr /\u003e |"]]