Download Android for free


  • void mediaSessionCompat.setFlags(int flags)
  • void mediaSessionCompat.setMediaButtonReceiver(PendingIntent mbr)
  • void mediaSessionCompat.setCallback(MediaSessionCompat.Callback callback)
  • void mediaSessionCompat.setActive(boolean active)
  • MediaSessionCompat.Token mediaSessionCompat.getSessionToken()
  • void mediaSessionCompat.release()
  • void mediaSessionCompat.setPlaybackState(PlaybackStateCompat state)
  • void mediaSessionCompat.setMetadata(MediaMetadataCompat metadata)


For best practice, use the media-compat library. The library takes care of backward compatibility by translating media session methods to the equivalent methods on older platform versions when available.

Related Examples

Receiving and handling button events