j2emanue
j2emanue

Reputation: 62519

android googleMap- how to get clickEvent for myLocation marker?

I have enabled the google map mylocation marker by the following:

googleMap.isMyLocationEnabled = true

then it will show the following:enter image description here

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

Answers (2)

kandroidj
kandroidj

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

Related Questions