Map is gray or white when I leave my page.
My problem is this: My map loads well but if I go to the menu or see other options when I return to the map, no load remains gray or white.
I solve it with the getCurrentPosition () what happens is that I occupy my location updated since it is an uber type service … so I do it with the watchPosition () and that’s where the map does not load me
Investigating I saw that the solution is to make a detector to the mosaic loading event but I have no idea what it is or how it is done if somebody guides me I thank you
ionViewDidLoad(){
if(this.ubiProv.solicitud){
this.agregarMarcas();
}else {
//this.initializeMap();
this.watchCurrentPosition()
//this.tryGeolocation();
}
}
watchCurrentPosition() {
navigator.geolocation.watchPosition(
(position)=> {
let pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
let options = {
center: new google.maps.LatLng(position.coords.latitude, position.coords.longitude),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
this.map = new google.maps.Map(document.getElementById("map"), options);
let marker = new google.maps.Marker({
map: this.map,
icon: new google.maps.MarkerImage('//maps.gstatic.com/mapfiles/mobile/mobileimgs2.png',
new google.maps.Size(22, 22),
new google.maps.Point(0, 18),
new google.maps.Point(11, 11)),
position: pos
});
let nombre = this.userProv.nombre
let content = nombre;
this.addInfoWindow(marker, content);
},
(error) => {
console.log(error);
});
}