Category : googleplacesautocomplete

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

I am creating an simple app where user types any address and gets suggestions, after clicking on any suggestion it will be displayed in a textview. Autcomplete initialization: try { val fields = listOf( Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG, Place.Field.ADDRESS) val intent=Autocomplete.IntentBuilder(AutocompleteActivityMode.FULLSCREEN, fields).build(this) startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE) }catch (e: Exception){ e.printStackTrace() } onActivityResult() code: if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE){ val ..

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 have functionality where I have to show different prices for my products in different cities. In android App I have to use get current latitude-longitude and show price w.r.t the city I am in. I am implementing backend too. But I am confused with the approach, how can I achieve different price in different ..

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

I am using this function to get search places result. fun onPlaceSelected(autocompleteFragment: AutocompleteSupportFragment) { autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME,Place.Field.LAT_LNG,Place.Field.ADDRESS)) autocompleteFragment.setOnPlaceSelectedListener(object : PlaceSelectionListener { override fun onError(err: Status) { Log.i(Constants.TAG, err.toString()) } override fun onPlaceSelected(place: Place) { // Send place to next fragment } }) } But The place.address and place.name is not the value I clicked on while ..

Read more