External Service

Masashi Katsumata edited this page Sep 28, 2016 · 7 revisions

Join the official community

New versions will be announced through the official community. Stay tune!

Do you have a question or feature request?

Feel free to ask me on the issues tracker.

Or on the official community is also welcome!

Jump to...

Clone this wiki locally

Recommend: Launch Navigator Cordova/Phonegap Plugin

External Service

The plugin does not implement some features, such as navigation, but the external applications have one. In this case, you can launch the external application.

Navigation

The launchNavigation method launches the Google Maps app. If Google Maps app is not available in iOS, Apple Maps app is launched. You can just pass from and to parameters.

As of version 1.2.3, you can also specify the travelMode parameter.

travelMode

  • driving
  • transit
  • bicycling
  • walking

Example1

plugin.google.maps.external.launchNavigation({
  "from": "Tokyo, Japan",
  "to": "Kyoto, Japan"
});

image

Example2

var yourLocation = null;
map.getMyLocation(function(location) {
  yourLocation = location.latLng;

  map.addMarker({
    "position": yourLocation,
    "title": "I am around here!"
  }, function(marker) {
    marker.showInfoWindow();
  });

  map.moveCamera({
    "target": yourLocation,
    "zoom": 12
  });
});

map.on(plugin.google.maps.event.MAP_CLICK, function(latLng) {
  map.addMarker({
    "position": latLng,
    "title": "Destination"
  }, function(marker) {
    marker.showInfoWindow();

    setTimeout(function() {

      if (confirm("Do you want to go?")) {
        plugin.google.maps.external.launchNavigation({
          "from": yourLocation,
          "to": latLng
        });
      }
    }, 2000);
  });
});

image


Class Reference

Method Return value Description
launchNavigation() void Launch the external navigation app.