cordova-plugin-googlemaps: Click marker doesn't work on iOS, custom marker icon doesn't show neither

Hi,

On android it works, but I don’t know why on ios that tap/click doesn’t fire the function attached to the marker.

this.pits.forEach((item, index) => {
           let a = new GoogleMapsLatLng(item.latitud, item.longitud);
           let am: GoogleMapsMarkerOptions = {
               position: a,
               //icon:"www/assets/images/markers/map-marker-pit.png",
           };
           this.map.addMarker(am)
           .then((marker: GoogleMapsMarker) => {
               console.log('adding  pit marker');
               marker.addEventListener(GoogleMapsEvent.MARKER_CLICK)
           .subscribe(e => {
               console.log('you hit a pit marker');
              this.openPageContenido(item);
           });

           });

       });
       openPageContenido(pit:any){
         console.log('OPENPAGECONTENIDO');
         let cl= new ContenidoList(pit.id,pit.nombre,"");
         this.navCtrl.push( ContenidoPage, {"contenidoList": cl});
      }

So running “ionic run ios -lc” I can see for each marker -> adding pit marker And the map shows all the markers, but If I tap one of them, there is no console log nor openPageContenido is fired.

Any idea?

Btw, I had to add:


.nav-decor{
     display:none!important;
   }

In order to be able to see he map, because otherwise a black screen is over the map. And I don’t know why, my custom markers are not displayed, I tried with different urls but no one worked. Meanwhile I leave them without my custom icon.

I’m using de v2 because in ios I couldn’t install the v1 (https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/1436)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (9 by maintainers)

Most upvoted comments

      map.addMarker(markerOptions).then((marker: Marker) => {
        console.log(marker);
          marker.on(GoogleMapsEvent.INFO_CLICK).subscribe(() => {
            console.log('hello');
        })
      });

Bit late but… This is probably what you’re looking for, works for me.

@ferminako Please use three-backslashes to show your code. screen shot 2017-05-10 at 12 28 29 pm