Package-level declarations

Types

Link copied to clipboard

If you are developing an Android application and want to know what is happening in the Spotify app, you can subscribe to broadcast notifications from it. The Spotify app can posts sticky media broadcast notifications that can be read by any app on the same Android device. The media notifications contain information about what is currently being played in the Spotify App, as well as the playback position and the playback status of the app.

Link copied to clipboard

Data from a broadcast event

Link copied to clipboard

Broadcast receiver types. These must be turned on manually in the Spotify app settings.

Link copied to clipboard
data class SpotifyMetadataChangedData(val playableUri: PlayableUri, val artistName: String, val albumName: String, val trackName: String, val trackLengthInSec: Int, val timeSentInMs: Long) : SpotifyBroadcastEventData

A metadata change intent is sent when a new track starts playing. It uses the intent action com.spotify.music.metadatachanged.

Link copied to clipboard
data class SpotifyPlaybackStateChangedData(val playing: Boolean, val positionInMs: Int, val timeSentInMs: Long) : SpotifyBroadcastEventData

A playback state change is sent whenever the user presses play/pause, or when seeking the track position. It uses the intent action com.spotify.music.playbackstatechanged.

Link copied to clipboard

A queue change is sent whenever the play queue is changed. It uses the intent action com.spotify.music.queuechanged.

Functions

Link copied to clipboard

Register a Spotify broadcast receiver (receiving notifications from the Spotify app) for the specified notification types.