ShwetaChauhan18 / GooglePlacesAutoComplete

GooglePlacesAutoComplete is a small kotlin demo for auto search in google map.🎉✨
Apache License 2.0
45 stars 14 forks source link

want latitude and longitude #12

Open anshusharma13 opened 2 years ago

anshusharma13 commented 2 years ago

how can i get latitude and longitude?

engosamamohsen commented 1 year ago

// Try That Define a Place ID. val placeId = "INSERT_PLACE_ID_HERE"

// Specify the fields to return. val placeFields = listOf(Place.Field.ID, Place.Field.NAME)

// Construct a request object, passing the place ID and fields array. val request = FetchPlaceRequest.newInstance(placeId, placeFields)

placesClient.fetchPlace(request) .addOnSuccessListener { response: FetchPlaceResponse -> val place = response.place Log.i(PlaceDetailsActivity.TAG, "Place found: ${place.name}") }.addOnFailureListener { exception: Exception -> if (exception is ApiException) { Log.e(TAG, "Place not found: ${exception.message}") val statusCode = exception.statusCode TODO("Handle error with given status code") } }