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));
});
}
thanks for your link , it helps and now it is working after change my code according the link .
1 Like
Congrats! Enjoy the maps plugin!
Iam facing same issue google map v3 … please help me
Zahema
March 8, 2019, 7:31am
6
Short answer for future reference: You need both myLocationButton
& myLocation
to be true.
1 Like
First of all congratulation for making a app.you are great man to making the best code mapping. most of people find location using map app.thanks for making a app for people benefits.
sir i have add both but in my case location button is not show i have used google-map 2.4.4 version tell me why it not working?
let mapg: GoogleMap = this.googleMaps.create(this.mapElement.nativeElement);
mapg.one(GoogleMapsEvent.MAP_READY).then((data: any) => {
mapg.setAllGesturesEnabled(true)
let cameraCoordinates: LatLng = new LatLng(latlongs[0].lat, latlongs[0].long);
mapg.setOptions({
controls: {
compass: true,
myLocationButton: true,
indoorPicker: true,
zoom: true
},
gestures: {
scroll: true,
tilt: true,
rotate: true,
zoom: true
},
});
mapg.setMyLocationEnabled(true);
mapg.setIndoorEnabled(true);
mapg.setTrafficEnabled(true);
mapg.setCompassEnabled(true);
mapg.setAllGesturesEnabled(true);
Sir am using
“@ionic-native /google-maps”: “^4.21.0”
Sir i haave also tried above veraion but i got multiple error related to the rxjs lib?
Which ionic version do you use? -I was using 4+
Sir i was using ionic 3.9 version?
The plugin version I was using should only be working with ionic 4 I guess. Anyway, I think you are better off opening a ticket there - the plugin github.
Ok sir thanks i will try on a github