map.setMyLocationButtonEnabled()
April 20, 2019 ยท View on GitHub
:warning: This document is aim for older versions (from 2.3.0 to 2.5.3). Document for new version is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md
map.setMyLocationButtonEnabled()
Set true if you want to show the MyLocation button.
- Please read here: The myLocation property has changed! since v2.2.0
marker.setMyLocationButtonEnabled(flag);
Parameters
| name | type | description |
|---|---|---|
| flag | boolean | false: disabled, true: enabled |
Demo code
<div class="map" id="map_canvas">
<span class="smallPanel"><button>current: map.myLocationButton = true</button></span>
</div>
var map = plugin.google.maps.Map.getMap(div, {
controls: {
myLocationButton: true,
myLocation: true
}
});
var isEnabled = true;
var button = div.getElementsByTagName('button')[0];
button.addEventListener('click', function() {
isEnabled = !isEnabled;
map.setMyLocationButtonEnabled(isEnabled);
button.innerHTML = "current: map.myLocationButton = " + isEnabled;
});
