Googlemap does not redenrize the map in Ionic3 app on Android and iOS platforms

Asked

Viewed 46 times

0

I developed an Ionic 3 application and implemented the Googlemaps API, when I run the command Ionic Cordova run browser the map works perfectly, but when I will perform the test on Android or Ios the map does not appear, shows only the screen with the Google logo at the bottom corner. I already followed the manual on the Ionic Framework website, but the fault continues to occur. Below is the code of the method that forms the map.

carregarMapa() {
    let element: HTMLElement = document.getElementById('map_canvas');
    let map: GoogleMap = this.googleMaps.create(element);

    Environment.setEnv({
      'API_KEY_FOR_BROWSER_RELEASE': CONF_API.apiKeyGoogle,
      'API_KEY_FOR_BROWSER_DEBUG': CONF_API.apiKeyGoogle
    });

    map.one(GoogleMapsEvent.MAP_READY).then(()=>{
      console.log('Map is ready!');

      let posicao: LatLng = new LatLng(this.posicao.lat, this.posicao.lng);

      let posicaoCam:  CameraPosition<LatLng> = {
        target: posicao,
        zoom: 15,
        tilt: 30
      }

      map.moveCamera(posicaoCam);

      //inserir um marcador
      let marcadorConfig: MarkerOptions = {
        position: posicao,
        title: 'Cliente'
      }
      map.addMarker(marcadorConfig).then((marcacao:Marker) =>{
        marcacao.showInfoWindow();
      });
    })
  }

On the Googleapis platform the Key is unrestricted, the Apis are active. I need support to make work on Android and iOS.

1 answer

0


I managed to resolve by removing the plugin(ionic cordova plugin remove cordova-plugin-googlemaps) and reinstalling.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.