Skip to content

External Service

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

###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.

Recommend: Launch Navigator Cordova/Phonegap Plugin

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.

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!


New version 2.0-beta2 is available.

The cordova-googlemaps-plugin v2.0 has more faster, more features.

https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/tree/master/v2.0.0/README.md

Clone this wiki locally