开发者

Google Map + phonegap in android

I want to implement Google Maps on android using phonegap and jquery.

I have followed this

The below script is unable to load on android emulator. Even though I have increased the time to 6 min. If i have commented开发者_如何学JAVA out the below script, i an able to see the screen but not Google map.

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>


Hi try this simple snippet, works on both android and ios. Just put script somewhere in body.

<script type="text/javascript">
window.mapReady = function(){
        // you can go with map loaded
};

function loadScript() {     
    var script = document.createElement('script');
    script.type = 'text/javascript';
    script.id = 'maps-script';
    script.src = 'http://maps.googleapis.com/maps/api/js?sensor=false&' +
        'callback=mapReady';
   //callback is the name of function to call once map script loaded
    document.body.appendChild(script);
}
 //Call to load map script
loadScript();
</script>


Are you sure the URL is not loading or is it this issue here: Android Emulator having issues with Geolocation where you need to set the geo location for the android simulator?


Here you van find plenty of examples http://code.google.com/apis/ajax/playground/?exp=maps#map_simple_v3 on Google maps APIV3


For future the same person, please try this plugin. https://github.com/wf9a5m75/phonegap-googlemaps-plugin

You can implement Google Maps into your app easily, and performance is really better than Google Maps JavaScript API v3. Because this plugin uses Google Maps Android API v2, which render the vector map tile in native side, thus very faster.

Google Map + phonegap in android

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜