ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

how to prevent it from asking for geolocation permission? #247

Closed leabdalla closed 4 years ago

leabdalla commented 4 years ago

My map is working good but its always asking for gps permission on Android and iOS devices and I don't need that, causa I'm starting the map in a certain location coming from API.

I'm starting the map this way:

    startMap(){

      this.map = GoogleMaps.create('map', {

        camera: {
          target:{lat:-23.5486, lng:-46.6392},
          zoom: 18
        },

        controls: {
          'compass'          : false,
          'myLocationButton' : false,
          'myLocation'       : true, // (blue dot)
          'indoorPicker'     : false,
          'zoom'             : false, // android only
          'mapToolbar'       : false // android only
        },

        gestures: {
          scroll : true,
          tilt   : false,
          zoom   : true,
          rotate : false
        },

        preferences: {
          zoom: {minZoom:6, maxZoom:10},
          building: true
        }
      });

      this.map.one(GoogleMapsEvent.MAP_READY).then( (data:any) => {

        let coordinates:LatLng = new LatLng(apidata.latitude, apidata.longitude);
        let position = { target: coordinates, zoom: apidata.zoomlevel };
        this.map.animateCamera(position);

      });

    }

How can I prevent the plugin from asking user's permission?

ndrake commented 4 years ago

Try setting myLocation to false.

leabdalla commented 4 years ago

it worked, thanks!

Arthur944 commented 4 years ago

Setting myLocation to false doesn't work for me. Any other ideas?