I'm using the code below to add multiple markers on the map. With each click a marker is added. In Chrome the code works perfectly, however, when generating the code using cordova the map is displayed but no bookmarks are added.
function initialize() {
var inicial = { lat: -22.4086028, lng: -43.6624047 };
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 17,
center: inicial
});
google.maps.event.addListener(map, 'mousedown', function(event) {
var initPoint = {x: event.pageX, y: event.pageY},
toBeCanceled = false,
latLong = event.latLong;
google.maps.event.addListener(map, 'mousemove', function(event) {
var newPoint = {x: event.pageX, y: event.pageY};
toBeCanceled = true
});
google.maps.event.addListener(map, 'mouseup', function(event) {
if (toBeCanceled) {
event.stop()
} else {
addMarker(event.latLng, map);
console.log(event.latLng.lat() +' _ ' + event.latLng.lng());
salvaPonto(event.latLng.lat(), event.latLng.lng());
event.latLng.empty();
}
});
});
}
function addMarker(location, map) {
var marker = new google.maps.Marker({
position: location,
label: "D",
map: map
});
}
google.maps.event.addDomListener(window, 'load', initialize);