android - PhoneGap and Google Map -
for school project i've phonegap application. want div map, , after makes interest points. it's impossible have in android emulator, got error "referenceerror can't find variable google". tried lot of solution i've found , thing can it's show little piece of map on top of application, on internet browser.
<!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script src="jquery.js"></script> <link rel="stylesheet" href="jquery.mobile-1.3.0.css" /> <script src="jquery.mobile-1.3.0.js"></script> <script src="jquery.mobile-1.3.0.min.js"></script> <style type="text/css"> #footer { position:fixed; bottom:0; left:0; right:0; } html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map-canvas { height: 100% } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=aizasybkh2nx6odt6pdpi-ktpnh_6lc7aj9z7d4&sensor=true"> </script> <script type="text/javascript"> function initialize() { var mapoptions = { center: new google.maps.latlng(-34.397, 150.644), zoom: 8, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map-canvas"), mapoptions); } google.maps.event.adddomlistener(window, 'load', initialize); </script> </head> </head> <body>
if have piece of code working on computer, or find error on mine happy. thanks.
the following works me in nexus 4 emulator. taken google maps javascript api:
<!doctype html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <script scr="jquery.js></script> <link rel="stylesheet" href="jquery.mobile-1.3.0.css" /> <script type="text/javascript" src="cordova-2.4.0.js"></script> <script type="text/javascript" src="jquery.mobile-1.3.0.min.js"></script> <style type="text/css"> html, body, #map-canvas { margin: 0; padding: 0; height: 100%; } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script type="text/javascript"> function initialize() { var mapoptions = { center: new google.maps.latlng(-34.397, 150.644), zoom: 8, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map-canvas"), mapoptions); } google.maps.event.adddomlistener(window, 'load', initialize); </script> </head> <body> <div id="map-canvas"></div> </body> </html>
Comments
Post a Comment