Пожалуйста, попробуйте пример кода из официальных документов
https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/README.md
Установка
$> ionic cordova plugin add cordova-plugin-googlemaps \
--variable API_KEY_FOR_ANDROID="(API_KEY_FOR_ANDROID)" \
--variable API_KEY_FOR_IOS="(API_KEY_FOR_IOS)"
$> npm install --save @ionic-native/core@latest @ionic-native/google-maps@latest
код
import {
GoogleMaps,
GoogleMap,
GoogleMapsEvent,
GoogleMapOptions,
CameraPosition,
MarkerOptions,
Marker
} from '@ionic-native/google-maps';
import { Component } from "@angular/core/";
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
map: GoogleMap;
constructor() { }
ionViewDidLoad() {
this.loadMap();
}
loadMap() {
let mapOptions: GoogleMapOptions = {
camera: {
target: {
lat: 43.0741904,
lng: -89.3809802
},
zoom: 18,
tilt: 30
}
};
this.map = GoogleMaps.create('map_canvas', mapOptions);
let marker: Marker = this.map.addMarkerSync({
title: 'Ionic',
icon: 'blue',
animation: 'DROP',
position: {
lat: 43.0741904,
lng: -89.3809802
}
});
marker.on(GoogleMapsEvent.MARKER_CLICK).subscribe(() => {
alert('clicked');
});
}
}