Displaying Blank screen by using cordova-plugin-google maps Ionic Framework

柔情痞子 提交于 2019-12-25 14:29:07

问题


am new to using cordova google maps in my ionic app.when used this plugin in my app am getting blank screen like

I followed step by step as mentioned in cordova google maps plugin

Generated valid google maps API key for Android device

this is the code i worked on it...

<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
var map;
document.addEventListener("deviceready", function() {
  var div = document.getElementById("map_canvas");

  // Initialize the map view
  map = plugin.google.maps.Map.getMap(div);

  // Wait until the map is ready status.
  map.addEventListener(plugin.google.maps.event.MAP_READY, onMapReady);
}, false);

function onMapReady() {
  var button = document.getElementById("button");
  button.addEventListener("click", onBtnClicked, false);
}

function onBtnClicked() {
  map.showDialog();
}
</script>
</head>
<body>
 <h3>PhoneGap-GoogleMaps-Plugin</h3>
 <div style="width:100%;height:400px" id="map_canvas"></div>
 <button id="button">Full Screen</button>
</body>
</html>

please help me anyone.

来源:https://stackoverflow.com/questions/34964432/displaying-blank-screen-by-using-cordova-plugin-google-maps-ionic-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!