Nevermind.Я нашел обходной путь, выполнив что-то вроде этого:
private fun calculateDirections(currentLocation: Point) {
activity?.let { context ->
MapboxDirections.builder()
.origin(currentLocation)
.destination(Point.fromLngLat(model.longitude, model.latitude))
.overview(DirectionsCriteria.OVERVIEW_FULL)
.profile(DirectionsCriteria.PROFILE_DRIVING_TRAFFIC)
.accessToken(Mapbox.getAccessToken() ?: "")
.build()
.enqueueCall(object : Callback<DirectionsResponse>{
override fun onFailure(call: Call<DirectionsResponse>, t: Throwable) {
}
override fun onResponse(
call: Call<DirectionsResponse>,
response: Response<DirectionsResponse>
) {
if(response.body() != null) {
val distance = response.body()!!.routes()[0].distance() ?: 0.0
val time = response.body()!!.routes()[0].duration() ?: 0.0
Toast.makeText(context,String.format("Distance: %.2f km Time: %.2f min",distance/1000.0, time/24), Toast.LENGTH_LONG).show()
}
}
})
}
}