startDataRequestsRoutine

fun startDataRequestsRoutine(vehicleId: String, requestsDelay: Long, errorRetryDelay: Long?, result: LastDataResultListener, onRoutineError: (error: Error) -> Unit)

Starts a routine that will request vehicle's last data at a defined frequency. The authorization token is automatically handled. If the request to get the authorization token fails with an auth failure error, the routine is stopped.

Parameters

vehicleId

the id of the vehicle obtained with Connected Car Data API

requestsDelay

delay in seconds before starting a new request after receiving a successful response

errorRetryDelay

delay in seconds before trying the API call again. If specified, the method will try to get data again after a connection or unexpected error

result

listener to get result

onRoutineError

called if an error related to this routine occurred