Category : google-places

Unit testing Google Places Autocompete API is not possible since creating fake response is not supported. Tried creating fake response with val placeResponse = Task<FindAutocompletePredictionsResponse>., unfortunately response creation is internal to API. Is there any way (or workaround) to accomplish this? @Test fun search_testSuccess() { // AutoComplete response val placeResponse = Task<FindAutocompletePredictionsResponse>. val searchConstraints = ..

Read more

Google Places’ fetchPlace() response sometimes has no locality field. I use it to get city name of a location. However, in predictions response city name available as a part of long address. Any thoughts? Thanks. Search: 85282 AZ Trail, Flagstaff, AZ, USA fetchPlace() response (no locality tag): [{"zza":"AZ Trail","zzb":"AZ Trail","zzc":["route"]},{"zza":"Coconino County","zzb":"Coconino County","zzc":["administrative_area_level_2","political"]},{"zza":"Arizona","zzb":"AZ","zzc":["administrative_area_level_1","political"]},{"zza":"United States","zzb":"US","zzc":["country","political"]},{"zza":"86001","zzb":"86001","zzc":["postal_code"]}] Source: Android ..

Read more

I have a list of place id in place_id array. The following code was able to print one place result only in the card view. My problem is how can I display all the element in place_id array to card view? place_id = [‘ChIJQ9kzlJJJzDERwc1eTl5tbrE’, ‘ChIJL7TdwMNJzDER77pgtyQY5_o’, ‘ChIJOyU6a9tJzDERUVxnunUeDBk’] private void getPlaceDetails(){ String url = buildUrl(place_id[0], apiKey); Log.d("finalUrl", ..

Read more

I have integrated Google Place Api as below in my project. Please check : edtAddress.setOnClickListener { // Set the fields to specify which types of place data to // return after the user has made a selection. val fields = listOf(Place.Field.ADDRESS, Place.Field.ADDRESS_COMPONENTS) // Start the autocomplete intent. val intent = activity?.let { it1 -> Autocomplete.IntentBuilder(AutocompleteActivityMode.FULLSCREEN, ..

Read more

I get the address but not the latlng package shweta.com.googleplacesautocomplete import android.util.Log import android.webkit.WebStorage import com.google.android.gms.maps.CameraUpdateFactory import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.model.LatLng import com.google.android.gms.maps.model.LatLngBounds import com.google.android.gms.tasks.Tasks import com.google.android.libraries.places.api.model.AutocompletePrediction import com.google.android.libraries.places.api.model.AutocompleteSessionToken import com.google.android.libraries.places.api.model.Place import com.google.android.libraries.places.api.model.TypeFilter import com.google.android.libraries.places.api.net.FetchPlaceRequest import com.google.android.libraries.places.api.net.FindAutocompletePredictionsRequest import com.google.android.libraries.places.api.net.PlacesClient import java.util.concurrent.ExecutionException import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException const val TASK_AWAIT = 120L const val MAP_CAMERA_ZOOM = 11f const ..

Read more

When the user type in their location in the auto complete support fragment, the result should return the places that I have set in the code. But in the code below, it does not working correctly. Here is the source which I refer to: https://developers.google.com/places/android-sdk/autocomplete#maps_places_programmatic_place_predictions-java public class MainActivity extends AppCompatActivity { private static final String ..

Read more