As we know, the google maps billing will produce when use the pingplacepicker.
And we find that getNearbyplace() triggers many times fetchPlace API call when user open map ,
that produces much billing for Places Details request.
Places Details SKU billing link:
https://developers.google.com/places/android-sdk/usage-and-billing#places-details
override fun getNearbyPlaces(location: LatLng): Single<List> {
val locationParam = "${location.latitude},${location.longitude}"
return googleMapsAPI.searchNearby(locationParam, PingPlacePicker.mapsApiKey)
.flatMap { searchResult ->
val singles = mutableListOf<Single<Place>>()
searchResult.results.forEach {
singles.add(**getPlaceById(it.placeId))**
}
private fun getPlaceById(placeId: String): Single {
// Create the request
val request = FetchPlaceRequest.builder(placeId, getPlaceFields()).build()
return Single.create { emitter ->
**googleClient.fetchPlace**(request)
.addOnSuccessListener {
emitter.onSuccess(it.place)
}
.addOnFailureListener {
emitter.onError(it)
}
}
During the last year, we pay a considerable sum of money to google for Places Details SKU
So do you have good advice for avoiding or reduce the request times for Places Details.
Hope your feedback.
Hi rtchagas,
override fun getNearbyPlaces(location: LatLng): Single<List> {
private fun getPlaceById(placeId: String): Single {