【发布时间】:2016-05-05 10:49:47
【问题描述】:
我对如何通过航路点查找从源到目的地的路线感到震惊,而无需在设备中打开外部 Google 地图应用程序。在我的应用程序中,我使用了 this plugin。
从这个插件中,我使用了这个 sn-p,但它渲染到设备中的谷歌地图应用程序。但我需要在同一个应用程序中执行此操作而不渲染到外部
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);
});
});
【问题讨论】:
标签: android cordova google-maps ionic-framework cordova-plugins