What reason cause google map mylocation button disabled


#1

Dear All,

I made app with ionic native google map plugin and set mapOptions like following , and install it on device, first time run it, ask me permission for device location, I choose ‘Allow’, but the ‘mylocation’ button is grey. I also use getcurrentPostion of geoLocation plugin, it does not work as well.

Any idea? thanks.

initialMap() {

    console.log('initial map');
    let mapOptions: GoogleMapOptions = {
        camera: {
            target: {
                lat: 0,
                lng: 0
            },
            zoom: 10,
            tilt: 30
        },
        controls: {
            zoom: true,
            myLocationButton : true
            
        }
    };

    this.mainMap = new GoogleMap('map', mapOptions);

    this.mainMap.one(GoogleMapsEvent.MAP_READY).then(() => {
        this.setupMapAfterReady();
    });
    
    this.mainMap.on(GoogleMapsEvent.MAP_DRAG_END).subscribe(() => {
        this.setupMapDragEvent();    
    });

}

setupMapAfterReady() {
this.getDevicePosition().then(result => {
console.log('device location is ’ + JSON.stringify(result));
if (result == RESULT.OK) {
this.mainMap.setCameraTarget(this.mapFilter.mapCenter);
}
},
err => {
console.log(JSON.stringify(err, CommUtil.replaceErrors));
});

}


#2

#3

thanks for your link , it helps and now it is working after change my code according the link .


#4

Congrats! Enjoy the maps plugin!