Added in API level 33

MediaSessionManager.OnMediaKeyEventSessionChangedListener


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

abstract void onMediaKeyEventSessionChanged(String packageName, MediaSession.Token sessionToken)

Called when the media key session is changed to the given media session.

Public methods

onMediaKeyEventSessionChanged

Added in API level 33
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.