0

My application cannot show google maps, it only show google icon i dnt know why this below my Config.xml

 <plugin name="cordova-plugin-googlemaps" spec="^2.1.1">
    <variable name="API_KEY_FOR_ANDROID" value="AIzaSyC4QCnAZ6KKvGMnNxS6gW34og8tGzHg658" />
</plugin>

this my Html

<div #map id="map" style="height: 100%; width:100% "></div>

and this my Home.ts

ionViewDidLoad(){
  this.LoadMap();
}
LoadMap(){
alert('PLATFORM READY!')
  let element = document.getElementById('map');
  let map: GoogleMap = this.GoogleMaps.create(element, {});
  let latlng = new LatLng(-6.2333,107);
  map.one(GoogleMapsEvent.MAP_READY).then(()=>{
    let position: CameraPosition<LatLng> = {
      target: latlng,
      zoom:10,
      tilt:30
    }
    map.moveCamera(position)
    let markeroptions: MarkerOptions = {
    position: latlng,
    title: 'Position'
  }
  let marker = map.addMarker(markeroptions).then((marker: Marker) => {
    marker.showInfoWindow();
  })
  })
}

sometime its working well also the map cannot show again, i dont know why

Indra suandi
  • 141
  • 1
  • 3
  • 15
  • Please make sure your plugin is updated and try https://ionicframework.com/docs/native/google-maps/ – core114 Dec 06 '17 at 10:56
  • yes,, i have installed plugin you mean, it still doesn't work – Indra suandi Dec 06 '17 at 11:01
  • The API key in Google Maps Android API should have an Android app restriction set. Did you restrict the API key as specified in the documentation? https://developers.google.com/maps/documentation/android-api/signup#detailed-guides – xomena Dec 08 '17 at 17:06

0 Answers0