I am currently trying to implement GoogleMaps through ionic. I am a total beginner, so please beware! I am getting an error:
console.warn: Native: tried accessing the GoogleMaps plugin but it's not installed.
whenever I run
ionic cordova build ios
ionic cordova emulate ios -lc
My code within home.ts looks as follows:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { GoogleMaps, GoogleMap, GoogleMapsEvent, LatLng } from '@ionic-native/google-maps';
@Component({
selector: 'page-home',
templateUrl: 'home.html',
})
export class HomePage {
map: GoogleMap;
constructor(public navCtrl: NavController, public geolocation: Geolocation, private googleMaps: GoogleMaps) {
console.log("Home page creator loaded");
}
ngAfterViewInit() {
console.log("ngAfterViewInit loaded");
let mapEle = document.getElementById('map');
let location = new LatLng(-34.9290,138.6010);
let mapOpt = {
center: {lat: -34.397, lng: 150.644},
zoom: 8,
};
this.map = this.googleMaps.create(mapEle, mapOpt);
this.map.one(GoogleMapsEvent.MAP_READY).then(() => {
console.log("Map seems ready!");
});
}
}
Mostly adapted to what the ionic-native GoogleMaps tutorial suggests. I have repeated uninstall and installed the ionic-native google-maps plugin again, but it just doesn't seem to work. Any idea what I might be doing wrong?