Reputation: 62519
I have enabled the google map mylocation marker by the following:
googleMap.isMyLocationEnabled = true
then it will show the following:
but now i want a click event when user touches this marker. how can i get this. i dont see anything exposed to get the event, can you help ?
Upvotes: 0
Views: 356
Reputation: 13922
To piggy back on the Razvan's answer with a code sample, It is possible:
googleMap!!.setOnMyLocationClickListener { location ->
Log.d("My Location", "onMyLocationClick() called with: location = [$location]")
}
where googleMap
is the GoogleMap
instance from onMapReadyCallback
Upvotes: 1
Reputation: 803
You can use the onMyLocationClickListener provided by GoogleMaps. https://developers.google.com/maps/documentation/android-sdk/reference/com/google/android/libraries/maps/GoogleMap.OnMyLocationClickListener
Upvotes: 2