AdevintaSpain / Leku

:earth_africa: Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
https://adevintaspain.github.io/Leku/
Apache License 2.0
763 stars 170 forks source link

GooglePlacesDataSource.java line 65 (Fatal Exception: java.lang.IllegalStateException: Task is not yet complete) #328

Closed dhaval951753 closed 2 years ago

dhaval951753 commented 2 years ago

private fun getAddressListFromPrediction(result: FindAutocompletePredictionsResponse?): List

{ val addressList = ArrayList
() result?.let { predictionsResults -> for (prediction in predictionsResults.autocompletePredictions) { val placeFields = listOf(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG, Place.Field.ADDRESS, Place.Field.ADDRESS_COMPONENTS) val fetchPlaceRequest = FetchPlaceRequest.builder(prediction.placeId, placeFields).build() val placeBufferResponseTask = geoDataClient.fetchPlace(fetchPlaceRequest) try { Tasks.await(placeBufferResponseTask, PLACE_BY_ID_WAITING_TIME, TimeUnit.SECONDS) } catch (ignored: ExecutionException) { } catch (ignored: InterruptedException) { } catch (ignored: TimeoutException) { }

            val placeBufferResponse = placeBufferResponseTask.result
            val place = placeBufferResponse?.place
            place?.let {
                addressList.add(mapPlaceToAddress(it))
            }
        }
    }
    return addressList
}

Please provide proper solution for this..
ferranpons commented 2 years ago

Solved in the new version 9.1.1