i used google map in project
it’s work fine in brwoser but not work on android when i run
cordova platform add android
how can i fixed it ?
loadMap() {
Environment.setEnv({
'API_KEY_FOR_BROWSER_RELEASE': '(AIzaSyAsQhHai1m971xeUsGsL7VaDQi95u2KcNU `https://`)',
'API_KEY_FOR_BROWSER_DEBUG': ''
});
LocationService.getMyLocation().then((myLocation: MyLocation) => {
let options: GoogleMapOptions = {
camera: {
target: myLocation.latLng,
zoom: 17,
}
};
this.map = GoogleMaps.create('map_canvas', options);
this.marker = this.map.addMarkerSync({
title: 'Ionic',
icon: {
url: 'assets/images/place2.png',
size: {
width: 32,
height: 32
}
},
position: myLocation.latLng,
});
this.marker.on(GoogleMapsEvent.MARKER_CLICK)
this.map.on(GoogleMapsEvent.MAP_CLICK).subscribe((data) => {
this.lat = data['0']['lat']
this.lat = data['0']['lng']
console.log(data['0']['lat'], data['0']['lng'])
localStorage.setItem('latitude', data[0]['lat'])
localStorage.setItem('longitude', data[0]['lng'])
localStorage.setItem('district', data[0]['subLocality'])
this.GetNewlocation(data['0']['lat'], data['0']['lng'])
this.marker.remove()
this.marker = this.map.addMarkerSync({
title: 'Ionic',
icon: {
url: 'assets/images/place2.png',
size: {
width: 32,
height: 32
}
},
position: { lat: data['0']['lat'], lng: data['0']['lng'] },
});
this.marker.on(GoogleMapsEvent.MARKER_CLICK)
}
);
});
}
in config file
<preference name="GOOGLE_MAPS_IOS_API_KEY" value="AIzaSyCGCjN3qK_eoYut2nOHluS8xw4TsRW4qGI" />