Prevent internal error
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.0-beta-20180126-0043" 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.2.0-beta-20180126-1033" 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/android/plugin/google/maps/PluginMap.java
src/android/plugin/google/maps/PluginMap.java
package plugin.google.maps;
+import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.graphics.Bitmap;
@@ -1704,18 +1705,25 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
}
}
- JSONObject params = args.getJSONObject(0);
- final Boolean isMyLocationButtonEnabled = params.getBoolean("myLocationButton");
- final Boolean isMyLocationEnabled = params.getBoolean("myLocation");
+ final JSONObject params = args.getJSONObject(0);
this.activity.runOnUiThread(new Runnable() {
+ @SuppressLint("MissingPermission")
@Override
public void run() {
try {
+ if (params.has("myLocationButton")) {
+ Boolean isMyLocationButtonEnabled = params.getBoolean("myLocationButton");
map.getUiSettings().setMyLocationButtonEnabled(isMyLocationButtonEnabled);
myLocationButton.setVisibility(isMyLocationButtonEnabled ? View.INVISIBLE : View.GONE);
+ }
+
+
+ if (params.has("myLocation")) {
+ Boolean isMyLocationEnabled = params.getBoolean("myLocation");
map.setMyLocationEnabled(isMyLocationEnabled);
- } catch (SecurityException e) {
+ }
+ } catch (Exception e) {
e.printStackTrace();
}
callbackContext.success();

MODIFY
www/Map.js
www/Map.js
@@ -29,8 +29,8 @@ var Map = function(id, _exec) {
var self = this;
BaseClass.apply(self);
- self.set("myLocation", true);
- self.set("myLocationButton", true);
+ self.set("myLocation", false);
+ self.set("myLocationButton", false);
self.MARKERS = {};
self.OVERLAYS = {};

Prevent internal error