POI_CLICK event

April 20, 2019 ยท View on GitHub

:warning: This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md

POI_CLICK event

This event is fired when you tap on POIs(such as building icon).

Parameters

nametypedescription
placeIdstringplace id for Google Places API
namestringplace name
latLngLatLngplace location

Demo code

<div id="map_canvas"></div>

var div = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(div, {
  camera: {
    target: {
      lat: 37.422000,
      lng: -122.084057
    },
    zoom: 15
  }
});

// Show a virtual dialog (loader.js)
showVirtualDialog(div, "Click on POI icon!");

map.on(plugin.google.maps.event.POI_CLICK, function(placeId, name, latLng) {
  var marker = map.addMarker({
    'position': latLng,
    'title': [
      "placeId = " + placeId,
      "name = " + name,
      "position = " + latLng.toUrlValue()
    ].join("\n")
  });
  marker.showInfoWindow();
});