I have Media Player that also provides equalizer bands.
brijesh kumar

Don’t try to access the MediaPlayer directly in your UI or create another binding. Instead, you can create a command which returning the result of getAudioSessionId():

  1. Call sendCommand(“getAudioSessionId”, null, myResultReceiver) on the MediaControllerCompat you create from your MediaBrowserCompat’s token.
  2. In your MediaSessionCompat.Callback, override onCommand(), looking for the getAudioSessionId command and return the value in the Bundle to the ResultReceiver.
  3. Now your ResultReceiver in your UI has access to the getAudioSessionId() value.

In this case, you need the ResultReceiver to get the result of the command. For one way operations where you don’t need a result, you could instead use sendCustomAction() and onCustomAction().

Show your support

Clapping shows how much you appreciated Ian Lake’s story.