The external service is removed.
MODIFY
plugin.xml
plugin.xml
<js-module name="Geocoder" src="www/Geocoder.js">
<runs />
</js-module>
- <js-module name="ExternalService" src="www/ExternalService.js">
- <runs />
- </js-module>
<js-module name="Map" src="www/Map.js">
<runs />
</js-module>
@@ -146,9 +143,6 @@ The native map view is faster, use less network usage, display 3D views, and eve
<feature name="KmlOverlay">
<param name="android-package" value="plugin.google.maps.PluginKmlOverlay" />
</feature>
- <feature name="External">
- <param name="android-package" value="plugin.google.maps.External" />
- </feature>
<feature name="Geocoder">
<param name="android-package" value="plugin.google.maps.PluginGeocoder" />
</feature>
@@ -174,7 +168,6 @@ The native map view is faster, use less network usage, display 3D views, and eve
<source-file src="src/android/plugin/google/maps/MyPluginLayout.java" target-dir="src/plugin/google/maps" />
<source-file src="src/android/plugin/google/maps/MyPluginInterface.java" target-dir="src/plugin/google/maps" />
<source-file src="src/android/plugin/google/maps/PluginCircle.java" target-dir="src/plugin/google/maps" />
- <source-file src="src/android/plugin/google/maps/External.java" target-dir="src/plugin/google/maps" />
<source-file src="src/android/plugin/google/maps/PluginGeocoder.java" target-dir="src/plugin/google/maps" />
<source-file src="src/android/plugin/google/maps/PluginGroundOverlay.java" target-dir="src/plugin/google/maps" />
<source-file src="src/android/plugin/google/maps/PluginKmlOverlay.java" target-dir="src/plugin/google/maps" />
@@ -238,9 +231,6 @@ The native map view is faster, use less network usage, display 3D views, and eve
<feature name="Environment">
<param name="ios-package" value="Environment" />
</feature>
- <feature name="External">
- <param name="ios-package" value="External" />
- </feature>
<feature name="Geocoder">
<param name="ios-package" value="PluginGeocoder" />
</feature>
@@ -275,8 +265,6 @@ The native map view is faster, use less network usage, display 3D views, and eve
<header-file src="src/ios/GoogleMaps/PluginCircle.h" />
<source-file src="src/ios/GoogleMaps/PluginCircle.m" />
- <header-file src="src/ios/GoogleMaps/External.h" />
- <source-file src="src/ios/GoogleMaps/External.m" />
<header-file src="src/ios/GoogleMaps/PluginGeocoder.h" />
<source-file src="src/ios/GoogleMaps/PluginGeocoder.m" />
<header-file src="src/ios/GoogleMaps/Environment.h" />

DELETE
src/android/plugin/google/maps/External.java
-package plugin.google.maps;
-
-import java.lang.reflect.Method;
-
-import org.apache.cordova.CallbackContext;
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.util.Log;
-
-public class External extends CordovaPlugin {
-
- private enum TRAVEL_MODE {
- driving,
- transit,
- bicycling,
- walking
- }
-
- @Override
- public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) {
- try {
- Method method = this.getClass().getDeclaredMethod(action, JSONArray.class, CallbackContext.class);
- if (method.isAccessible() == false) {
- method.setAccessible(true);
- }
- method.invoke(this, args, callbackContext);
- return true;
- } catch (Exception e) {
- Log.e("CordovaLog", "An error occurred", e);
- callbackContext.error(e.toString());
- return false;
- }
- }
-
- /**
- * Send an intent to the navigation applications
- * @param args
- * @param callbackContext
- * @throws JSONException
- */
- @SuppressWarnings("unused")
- private void launchNavigation(JSONArray args, CallbackContext callbackContext) throws JSONException {
- JSONObject params = args.getJSONObject(0);
- String from = params.getString("from");
- String to = params.getString("to");
-
- Uri.Builder builder = new Uri.Builder();
- builder.scheme("http")
- .authority("maps.google.com")
- .appendPath("maps")
- .appendQueryParameter("saddr", from)
- .appendQueryParameter("daddr", to);
-
- if (params.has("travelMode")) {
- TRAVEL_MODE mode = null;
- try {
- mode = TRAVEL_MODE.valueOf(params.getString("travelMode"));
- } catch (Exception e){}
- //travel mode
- if (mode != null) {
- String dirFlag = "d";
- switch (mode) {
- case walking:
- dirFlag="w";
- break;
-
- case transit:
- dirFlag="r";
- break;
-
- case bicycling:
- dirFlag="b";
- break;
- default:
- break;
-
- }
- builder.appendQueryParameter("dirflg", dirFlag);
- }
- }
-
- Intent intent = new Intent(android.content.Intent.ACTION_VIEW, builder.build());
- this.cordova.getActivity().startActivity(intent);
-
- PluginResult result = new PluginResult(PluginResult.Status.NO_RESULT);
- callbackContext.sendPluginResult(result);
- }
-
-}

DELETE
src/ios/GoogleMaps/External.h
-//
-// External.h
-// cordova-googlemaps-plugin v2
-//
-// Created by Masashi Katsumata.
-//
-//
-
-#import "CordovaGoogleMaps.h"
-#import "MyPlgunProtocol.h"
-
-@interface External : CDVPlugin
-
--(void)launchNavigation:(CDVInvokedUrlCommand *)command;
-
-@end

DELETE
src/ios/GoogleMaps/External.m
-//
-// External.m
-// cordova-googlemaps-plugin v2
-//
-// Created by Masashi Katsumata.
-//
-//
-
-#import "External.h"
-
-@implementation External
-
-/**
- * Launch the Google Maps App if it is installed.
- * Otherwise launch the Apple Map.
- */
--(void)launchNavigation:(CDVInvokedUrlCommand *)command
-{
- NSDictionary *json = [command.arguments objectAtIndex:0];
- NSString *from = [json objectForKey:@"from"];
- NSString *to = [json objectForKey:@"to"];
- NSString *directionsRequest = nil;
-
- from = [from stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- to = [to stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
-
- NSURL *googleMapsURLScheme = [NSURL URLWithString:@"comgooglemaps-x-callback://"];
- if ([[UIApplication sharedApplication] canOpenURL:googleMapsURLScheme]) {
-
- NSMutableArray *params = [NSMutableArray array];
- [params addObject:[NSString stringWithFormat:@"saddr=%@", from, nil]];
- [params addObject:[NSString stringWithFormat:@"daddr=%@", to, nil]];
- if ([json objectForKey:@"travelMode"] != nil) {
- [params addObject:[NSString stringWithFormat:@"directionsmode=%@", [json objectForKey:@"travelMode"], nil]];
- }
- NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
- [params addObject:[NSString stringWithFormat:@"x-success=%@://?resume=true", bundleIdentifier, nil]];
-
- NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
- appName = [appName stringByReplacingOccurrencesOfString:@" " withString:@""];
- [params addObject:[NSString stringWithFormat:@"x-source=%@", appName, nil]];
-
- directionsRequest =
- [NSString stringWithFormat: @"comgooglemaps-x-callback://?%@", [params componentsJoinedByString: @"&"], nil];
- } else {
- directionsRequest =
- [NSString stringWithFormat: @"https://maps.apple.com/?saddr=%@&daddr=%@",
- from, to, nil];
- }
- NSURL *directionsURL = [NSURL URLWithString:directionsRequest];
- [[UIApplication sharedApplication] openURL:directionsURL];
-
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-@end

DELETE
www/ExternalService.js
-/*****************************************************************************
- * External service
- *****************************************************************************/
-var ExternalService = {};
-
-ExternalService.launchNavigation = function(params) {
- params = params || {};
- if (!params.from || !params.to) {
- return;
- }
- if (typeof params.from === "object" && "toUrlValue" in params.from) {
- params.from = params.from.toUrlValue();
- }
- if (typeof params.to === "object" && "toUrlValue" in params.to) {
- params.to = params.to.toUrlValue();
- }
- //params.from = params.from.replace(/\s+/g, "%20");
- //params.to = params.to.replace(/\s+/g, "%20");
- cordova.exec(null, null, "External", 'launchNavigation', [params]);
-};
-
-module.exports = ExternalService;

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -33,7 +33,6 @@ if (!cordova) {
var encoding = require('./encoding');
var spherical = require('./spherical');
var Geocoder = require('./Geocoder');
- var ExternalService = require('./ExternalService');
var Environment = require('./Environment');
var MapTypeId = require('./MapTypeId');
@@ -643,7 +642,6 @@ if (!cordova) {
LatLngBounds: LatLngBounds,
Marker: Marker,
MapTypeId: MapTypeId,
- external: ExternalService,
environment: Environment,
Geocoder: Geocoder,
geometry: {

The external service is removed.