Stats

93 Contributors: 4 Sunday, August 6, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap
Download eBook

MediaSession

Download android eBook

Syntax

  • 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)

Remarks

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