(Browser) Fix: can not load API key from xml
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.4.0-ext-20180822-2211" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.4.0-ext-20180822-2234" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs/>

MODIFY
src/browser/CordovaGoogleMaps.js
src/browser/CordovaGoogleMaps.js
@@ -65,11 +65,15 @@ document.addEventListener("load_googlemaps", function() {
.then(function(configFile) {
var API_KEY_FOR_BROWSER = null;
if (configFile.indexOf("API_KEY_FOR_BROWSER") > -1) {
- var matches = configFile.match(/name\s*?=\s*?[\"\']API_KEY_FOR_BROWSER[\"\']\s+?value\s*?=\s*?[\"\']([^\"]+)[\"\']/i);
+ var matches = configFile.match(/name\s*?=\s*?[\"\']API_KEY_FOR_BROWSER[\"\'][^>]+>/i);
+ if (matches) {
+ var line = matches[0];
+ matches = line.match(/value\s*?=\s*?[\"\'](.*?)[\"\']/i);
if (matches) {
API_KEY_FOR_BROWSER = matches[1];
}
}
+ }
var secureStripeScript = document.createElement('script');
if (API_KEY_FOR_BROWSER) {

(Browser) Fix: can not load API key from xml