downloadAndSync

fun downloadAndSync(station: Station, downloadListener: StationDownloadListener)

Downloads or updates an offline station.

This method kicks off an asynchronous download to retrieve audio files for the given station. As the station downloads, events (1 at a minimum) will be sent to the provided listener.

The station passed in must come from the remoteOfflineStationList

Note that if a station with the same name has already been downloaded or partially downloaded to local storage already, only missing music will be downloaded. Some stations can additionally be configured (on the server) so that only a subset of the full station contents are saved on client devices, and each request to downloadAndSync will cause recently played music to be deleted and new music to be downloaded.

Parameters

station

remote offline station from remoteOfflineStationList

downloadListener

listener that receive updates on download progress

fun downloadAndSync(targetMins: Int, station: Station, downloadListener: StationDownloadListener)

Download or update an offline station, but with an extra hint to the server as to the number of minutes of music that the client wants to be downloaded. This can be used to prevent a station with, say, 600 minutes, from being completely downloaded in a single call. If the given station already has content stored on the device, the server determines whether or not the client will 1) download any music,

  1. replace any music, or 3) download additional music

Parameters

targetMins

desired number of minutes to be transferred

station

remote offline station from remoteOfflineStationList

downloadListener

Listener that receives updates on download progress