Skip to content

[google-maps] Draggable Marker Bug on Android, setOnMarkerDragEndListener is never called (none of the drag events are called), works well on iOS & Web #134

@FlossyWeb

Description

@FlossyWeb

Bug Report

Plugin(s)

"@capacitor/google-maps": "^6.0.1"

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 6.2.0
  @capacitor/core: 6.2.0
  @capacitor/android: 6.2.0
  @capacitor/ios: 6.2.0

Installed Dependencies:

  @capacitor/cli: 6.2.0
  @capacitor/core: 6.2.0
  @capacitor/android: 6.2.0
  @capacitor/ios: 6.2.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Platform(s)

Android (on all tested devices).

Current Behavior

When dragging any draggable marker, the drag events are never called especially setOnMarkerDragEndListener which is the most useful.
iOS & Web works perfectly as expected ☺️
When connecting an android device to my machine for debug purpose I can't see no errors in the console and it never gets in none of the drag events.

Expected Behavior

On iOS & Web platforms the marker is nicely dragged to a new spot then setOnMarkerDragEndListener is fired and helps with getting back marker's new latitude & longitude for instance.

Code Reproduction

// Markers are added to the map that way :
				const step = App.settings.customPathMarkers.length + 1
				const newMarker = {
					coordinate: { lng: data.longitude, lat: data.latitude },
					iconUrl: `${App.settings.serverAppUrl}/online_assets/icons/geoPinMarker.png`,
					iconSize: { width: 64, height: 64 },
					iconAnchor: { x: 32, y: 64 },
					draggable: true,
					opacity: 0.8,
					zIndex: 200,
					title: '#' + step,
					snippet: data.latitude + ', ' + data.longitude
				}
				const newMarkerId = await App.settings.homeMap.addMarker(newMarker)
				newMarker.markerId = newMarkerId
				App.settings.customPathMarkers.push(newMarker)
// And here is the drag end event...
	setOnMarkerDragEndListener: async () => {
		App.settings.homeMap.setOnMarkerDragEndListener(async (data) => {
                        // Android never gets there and the marker gets back to it's original position !
			console.log('setOnMarkerDragEndListener', data) // { "mapId": "home-map", "markerId": "8119", "latitude": 43.331135153612585, "longitude": 5.377732682633138,"title": "#3", "snippet": ""}
			if (App.settings.creating) {
				const thisMarker = App.settings.customPathMarkers.find(marker => marker.markerId == data.markerId)
				thisMarker.coordinate.lat = data.latitude
				thisMarker.coordinate.lng = data.longitude
				App.drawItCreation()
			}
			if (App.settings.relocating) {
				App.settings.relocateMarker.coordinate.lat = data.latitude
				App.settings.relocateMarker.coordinate.lng = data.longitude
			}
		})
	},

Other Technical Details

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproductionNeeds a reproduction project before being looked into

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions