mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 913 forks source link

Is there a way to prevent the map from requesting location permission? #2869

Open kaddyadriano opened 3 years ago

kaddyadriano commented 3 years ago

I'd like to prevent the map from requesting for permission since this is handled somewhere else. I have tried:

var map = plugin.google.maps.Map.getMap(div, {
  controls: {
    myLocationButton: false,
    myLocation: false
  }
});

No luck. Please help!

KimberleeDArmstrong commented 2 years ago

I am having the same problem. I have both set to false and my app is not requesting location information from the user. You can see in iOS I do not have any location permissions set and it is all working fine, but on Android it is still asking for permission even though I am not requesting it.

IMG_051AAE2A0F6D-1

marcorosetti commented 2 years ago

I'd like to prevent the map from requesting for permission since this is handled somewhere else. I have tried:

var map = plugin.google.maps.Map.getMap(div, {
  controls: {
    myLocationButton: false,
    myLocation: false
  }
});

No luck. Please help!

Caused by this line of code in PluginMap.java: if (controls.has("myLocationButton") || controls.has("myLocation")) {

You need to remove myLocationButton and myLocation from controls property in order to prevent the check