I installed native cordova plugin GitHub - mapsplugin/cordova-plugin-googlemaps: Google Maps plugin for Cordova
Then I used this tutorial to show GMaps https://ionicframework.com/docs/native/google-maps/
Which worked but not very well.
So I used this and it works perfectly, but I can’t add marker, it’s not showing up
let location = new GoogleMapsLatLng(-34.9290,138.6010);
this.map = new GoogleMap('map', { 'backgroundColor': 'white', 'controls': { 'compass': true, 'myLocationButton': true, 'indoorPicker': true, 'zoom': false }, 'gestures': { 'scroll': true, 'tilt': true, 'rotate': true, 'zoom': true }, 'camera': { 'latLng': location, 'tilt': 0, 'zoom': 15, 'bearing': 50 } });
this.map.addMarker({ 'position': location, 'visible': true, 'markerClick': function(marker) { } });
EDIT SOLVED:
I had to add “addMarker” inside GoogleMapsEvent:MapReady like this:
this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() =>
{
console.log(‘Map is ready!’);
this.map.addMarker({
‘position’: location,
‘visible’: true,
‘markerClick’: function(marker) {
}
});
});
Maybe documentation should be updated?