question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

addMarker callback not executed

See original GitHub issue

I’m using ionic 2 and executing on Android M (device, not emulator) I need to add a marker to a map and retain a reference so I can rotate it later. If I add it via e.g.

this.mapping.map.addMarker({'position': coords, 'icon': icon, 'rotation': 90}, (marker) => {
  alert("TEST");
});

The marker is placed but the callback is never executed. I’ve put some debugging output into googlemaps-cdv-plugin.js and everything looks like it’s working fine, I’ve verified via alerts that typeof callback === “function” returns true and that both self and marker in callback.call are objects.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
janrgcommented, Nov 19, 2016

Brilliant thank you! I’m using v2 now without the wrapper and it works. Thank you so much for your help. I think I’ve found a very minor bug in the marker btw. Lines 238 to 245 in Marker.js read

Marker.prototype.setRotation = function(rotation) {
    if (!rotation) {
        console.log('missing value for rotation');
        return false;
    }
    this.set('rotation', rotation);
    return this;
};

The issue is that 0 and 0.0 are both falsy, so setRotation(0) will not work. Perhaps something like

if (!rotation && typeof rotation !== 'number')

or even just the second condition would be better.

0reactions
wf9a5m75commented, Nov 22, 2016

@janrg Thanks for inspecting. I fixed the problem position.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does my add marker button not work? - Stack Overflow
I am currently working on an Android studio app where I need a map. In this map I have a button called, add...
Read more >
addMarker: markers not showing up using google.maps ...
At this point I'm only trying to get the markers to show up - I know the use of title is wrong etc....
Read more >
GoogleMap | Maps SDK for Android - Google Developers
Sets a callback that is invoked repeatedly while the camera is in motion. The callback may be invoked as often as once every...
Read more >
Geolocation with add marker function - Google Groups
... addmarker) together on the google map api javascript, because the geolocation function not working when there are add marker function on ...
Read more >
Add Custom Markers with the Google Maps JavaScript API
Now notice that it has a parameter called callback that's set to an ... function addMarker(coordinates) { var marker = new google.maps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found