I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude a
I got very simple solution to this problem thanks answer by Muhammad Yasir.
List placeFields = Arrays.asList(Place.Field.LAT_LNG, Place.Field.ADDRESS_COMPONENTS);
autocompleteFragment.setPlaceFields(placeFields);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
LatLng latLng = place.getLatLng(); // This will have required latitude and longitude
}
}
You can specify any field you want as in the list like name, address etc.
Note: This answer is for android java but I think there will be similar approach in other languages like javascript.