Wondered if someone could help. I have just come back to phonegap
after a while and see that it has progressed. Great work!
Now onto my question:)
Im trying to make a standalone app that can utilise location.
I have downloaded the latest build and see that it now has a nice WWW
folder and all my extenral js and css works wonderfully now.
However, I am stumped by how to hook in the gap.js and get location
data back.
1) I have placed gap.js in the www folder with the rest of my elements
2)I have linked to it from my html (<script src="gap.js" type="text/
javascript"></script>)
3)I call initGap() onLoad (<body onLoad="initGap();">)
4) I have added the following to my index.html for now
<script>
initGap = function() {
Device.init();
Device.Location.callback = updateLocation;
}
updateLocation = function(lat,lon) {
document.getElementById('lat').innerHTML = lat;
document.getElementById('lon').innerHTML = lon;
}
</script>
5)I have added a link to call the location function in my html:
<a href="#" onClick="Device.Location.init()" >Click here to get the
location.</a>
6)I have added 2 divs also for lat and lon
<div id="lan">fff</div>
<div id="lon">fff</div>
However, when i run this via the simulator and click the link to call
the location nothing updates. I have added some alerts into gap.js so
I can see that location.init is being triggered. But i get nothing
back re location data.
Any pointers would be great.
ade