Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can get latitude & longitude after place selection ? #66

Closed
AmrutGhatage opened this issue Jan 12, 2018 · 1 comment
Closed

How I can get latitude & longitude after place selection ? #66

AmrutGhatage opened this issue Jan 12, 2018 · 1 comment

Comments

@AmrutGhatage
Copy link

AmrutGhatage commented Jan 12, 2018

autocomplete.setOnPlaceSelectedListener(
new OnPlaceSelectedListener() {
@OverRide
public void onPlaceSelected(final Place place) {
// do something awesome with the selected place

                }
            }
    );
@sddamico
Copy link
Member

@AmrutGhatage once you have the Place object, you'll need to request the place details. Once you have the place details you should be able to access the lat/lon from the data model:

autocomplete.getDetailsFor(place, new DetailsCallback() {
                @Override
                public void onSuccess(PlaceDetails details) {
                    double lat = details.geometry.location.lat;
                    double lon = details.geometry.location.lon;
                }

                @Override
                public void onFailure(Throwable failure) {
                }

                public void onComplete() {
                }
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants