Bug fix: Android: setMyLocationEnabed(true) hide MyLocationButton
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.2.4" 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.5-beta-20180214-1417" 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
www/Map.js
www/Map.js
@@ -123,6 +123,10 @@ Map.prototype.getMap = function(mapId, div, options) {
this.set('camera_tilt', options.camera.tilt);
}
}
+ if (options.controls) {
+ this.set('myLocation', options.controls.myLocation === true);
+ this.set('myLocationButton', options.controls.myLocationButton === true);
+ }
args.push(options);
} else {
@@ -151,6 +155,10 @@ Map.prototype.getMap = function(mapId, div, options) {
this.set('camera_tilt', options.camera.tilt);
}
}
+ if (options.controls) {
+ this.set('myLocation', options.controls.myLocation === true);
+ this.set('myLocationButton', options.controls.myLocationButton === true);
+ }
if (utils.isArray(options.styles)) {
options.styles = JSON.stringify(options.styles);
}
@@ -528,11 +536,12 @@ Map.prototype.moveCamera = function(cameraPosition, callback) {
};
Map.prototype.setMyLocationButtonEnabled = function(enabled) {
+ var self = this;
enabled = common.parseBoolean(enabled);
this.set("myLocationButton", enabled);
exec.call(this, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
myLocationButton: enabled,
- myLocation: this.get("myLocation")
+ myLocation: self.get("myLocation")
}], {
sync: true
});
@@ -540,10 +549,11 @@ Map.prototype.setMyLocationButtonEnabled = function(enabled) {
};
Map.prototype.setMyLocationEnabled = function(enabled) {
+ var self = this;
enabled = common.parseBoolean(enabled);
this.set("myLocation", enabled);
exec.call(this, null, this.errorHandler, this.id, 'setMyLocationEnabled', [{
- myLocationButton: this.get("myLocationButton"),
+ myLocationButton: self.get("myLocationButton"),
myLocation: enabled
}], {
sync: true

Bug fix: Android: setMyLocationEnabed(true) hide MyLocationButton #2076