From 918eb5a1bfce9595e922b3ad2442ff81cb9a0fa0 Mon Sep 17 00:00:00 2001 From: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com> Date: Fri, 21 May 2021 17:33:55 +1000 Subject: [PATCH 1/2] Fix blank map when starting app using cordova-android branch which has upgraded AGP to 4.1.3 --- src/android/plugin/google/maps/CordovaGoogleMaps.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/android/plugin/google/maps/CordovaGoogleMaps.java b/src/android/plugin/google/maps/CordovaGoogleMaps.java index 7e965dcee..a22702599 100644 --- a/src/android/plugin/google/maps/CordovaGoogleMaps.java +++ b/src/android/plugin/google/maps/CordovaGoogleMaps.java @@ -448,15 +448,13 @@ public void getMap(final JSONArray args, final CallbackContext callbackContext) //------------------------------------------ JSONObject meta = args.getJSONObject(0); String mapId = meta.getString("__pgmId"); - PluginMap pluginMap = new PluginMap(); - pluginMap.privateInitialize(mapId, cordova, webView, null); - pluginMap.initialize(cordova, webView); - pluginMap.mapCtrl = CordovaGoogleMaps.this; - pluginMap.self = pluginMap; + PluginMap pluginMap = new PluginMap(); PluginEntry pluginEntry = new PluginEntry(mapId, pluginMap); pluginManager.addService(pluginEntry); + pluginMap.mapCtrl = CordovaGoogleMaps.this; + pluginMap.self = pluginMap; pluginMap.getMap(args, callbackContext); } From 0b8ea76ad34fb2a202a9de1b9d0e051a82ad9443 Mon Sep 17 00:00:00 2001 From: 8bhsolutions <48874658+8bhsolutions@users.noreply.github.com> Date: Fri, 21 May 2021 22:50:56 +1000 Subject: [PATCH 2/2] Fixed same usage pattern in other areas of the plugin --- src/android/plugin/google/maps/CordovaGoogleMaps.java | 8 +++----- src/android/plugin/google/maps/PluginMap.java | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/android/plugin/google/maps/CordovaGoogleMaps.java b/src/android/plugin/google/maps/CordovaGoogleMaps.java index a22702599..6239f26d9 100644 --- a/src/android/plugin/google/maps/CordovaGoogleMaps.java +++ b/src/android/plugin/google/maps/CordovaGoogleMaps.java @@ -468,14 +468,12 @@ public void getPanorama(final JSONArray args, final CallbackContext callbackCont String mapId = meta.getString("__pgmId"); Log.d(TAG, "---> mapId = " + mapId); PluginStreetViewPanorama pluginStreetView = new PluginStreetViewPanorama(); - pluginStreetView.privateInitialize(mapId, cordova, webView, null); - pluginStreetView.initialize(cordova, webView); - pluginStreetView.mapCtrl = CordovaGoogleMaps.this; - pluginStreetView.self = pluginStreetView; - PluginEntry pluginEntry = new PluginEntry(mapId, pluginStreetView); pluginManager.addService(pluginEntry); + pluginStreetView.mapCtrl = CordovaGoogleMaps.this; + pluginStreetView.self = pluginStreetView; + pluginStreetView.getPanorama(args, callbackContext); } diff --git a/src/android/plugin/google/maps/PluginMap.java b/src/android/plugin/google/maps/PluginMap.java index a3d379f0e..96d4fbb67 100644 --- a/src/android/plugin/google/maps/PluginMap.java +++ b/src/android/plugin/google/maps/PluginMap.java @@ -613,9 +613,6 @@ public synchronized void loadPlugin(final JSONArray args, final CallbackContext plugins.put(pluginName, pluginEntry); mapCtrl.pluginManager.addService(pluginEntry); - plugin.privateInitialize(pluginName, cordova, webView, null); - - plugin.initialize(cordova, webView); ((MyPluginInterface)plugin).setPluginMap(PluginMap.this); MyPlugin myPlugin = (MyPlugin) plugin; myPlugin.self = (MyPlugin)plugin; @@ -666,8 +663,6 @@ public void create(final JSONArray args, final CallbackContext callbackContext) pluginMap = PluginMap.this; pluginMap.mapCtrl.pluginManager.addService(pluginEntry); - plugin.privateInitialize(className, cordova, webView, null); - plugin.initialize(cordova, webView); ((MyPluginInterface)plugin).setPluginMap(PluginMap.this); pluginEntry.plugin.execute("create", args, callbackContext);