Bug 36933 - Mapbox SDK: MapView.MarkerClick event is only raised once
Summary: Mapbox SDK: MapView.MarkerClick event is only raised once
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: Production (addons.xamarin.com)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2015-12-12 01:38 UTC by bobme981
Modified: 2016-03-11 19:34 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description bobme981 2015-12-12 01:38:49 UTC
[Originally posted in the Xamarin forums: http://forums.xamarin.com/discussion/comment/168811]

I'm using the just-released 3.0.0 version of the Mapbox SDK component published by Xamarin. It looks pretty good so far, but I'm running into a strange problem with markers.

The MarkerClick event is only raised on the first tap or click of a given marker.

After that, the delegate never gets called again no matter how many times I tap or click the marker. If I remove the unclickable marker and add a new one in its place, the event will be raised again on the first tap or click for the new marker, but then it will stop working again. This also occurs if I call SetOnMarkerClickListener() directly instead of using the MarkerClick event. My implementation of IOnMarkerClickListener will get called on the first tap or click, but after that, nothing.

After looking at the Xamarin code in Assembly Browser and the native Mapbox GL code on github (see link below), it looks like the selectMarker method in the underlying MapView class automatically "selects" a marker when it has been tapped or clicked, regardless of whether the event handler says the event was "handled" or not. The MarkerClick event is no longer raised for that marker while it is deselected.

Unfortunately, though, the Xamarin wrapper for the MapView does not expose the underlying DeselectMarker/Markers methods, so I don't see any way to programmatically re-enable click events without waiting for the user to click elsewhere on the map. Based on the latest underlying code, this should automatically deselect any selected markers, and once that happens, the MarkerClick event should start working again. However, I'm not seeing this behavior (still no click events even after clicking off from the marker), so if I just want to handle click events and not get the default behavior of showing (and later dismissing) an info window, I don't see a workaround.

Mapbox GL links: 
https://github.com/mapbox/mapbox-gl-native/blob/master/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
https://github.com/mapbox/mapbox-gl-native/issues/3176
Comment 1 Jon Dick 2016-03-11 19:34:11 UTC
I'm not seeing this behaviour in the latest version of the bindings and component (v3.2.0.3).  Could you please give it another try?