javascript - How do I load Google Maps JS API in PhoneGap to use it multiple times? -


i'm developing phonegap application multiple pages , of them show map.

now i'm trying load google maps api when page loads can access whenever need it. there several options:

  1. load script without callback parameter in url ...(url)&callback=functionname when page loads
    result: google.maps object created it's empty. functions missing.

  2. load script with callback parameter in url when page loads
    result: functions in google.maps available, when create map, empty <div style="overflow-x: hidden; overflow-y: hidden;"></div> inside container element. seems starts create map, rest missing.
    funny thing here is: works in desktop browsers, not in phonegap application - doesn't matter if android or ios.

  3. load script with callback, every time map should displayed
    result: seems work, error/a warning in console shows up, telling me there may occur unexpected problems if load maps api more once. plus creates unnecessary server requests slow down application.

running option 2 in ripple emulator tells me application tries open inappbrowser when open page should display map. don't have experience inappbrowser, don't know trying tell me or if related problem...

currently i'm including script via simple

var script = document.createelement('script'); script.type ... script.src = 'http://maps.googleapis.com/.....'; document.body.appendchild(script); 

does know how include , use api in case this? parameters want pass new google.maps.map() constructor differ. need flexible way this.

thanks help
andreas


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -