ionic-team / ionic-team/capacitor-google-maps

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

Open
#134 2 comments 0 reactions 0 assignees View on GitHub
needs reproduction
Dominant language
TypeScript
Stars
32
Forks
47
PR merge metrics
No merged PRs in 30d

Description

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.