the code from LC is here
Code: Select all
local browserID
local theURL
on preOpenCard
# quit if we are not on a mobile device
if the environment is not "mobile" then exit preOpenCard
if mobileCanTrackLocation() is true then
mobileStartTrackingSensor "location"--,true
mobileStartTrackingLocation -- Will fire locationChanged when GPS is found
wait 3 seconds
put mobileCurrentLocation() into tLocation
put tLocation["latitude"] into fld "dlat"
put tLocation["longitude"] into fld "dlong"
put fld"dlat"& comma & fld"dlong" into fld "latlong"
else
Answer "This mobile is NOT able to track GPS location"
end if
#test
put specialFolderPath("documents") & "/tt1.html" into documentFilePath
if there is not a file documentFilePath then
put specialFolderPath("engine") & "/tt1.html" into engineFilePath
put URL ("binfile:" & engineFilePath) into URL ("binfile:" & documentFilePath)
end if
put specialFolderPath("documents") & "/tt1.html" into thehtmlFile
put URL("file:" & thehtmlFile) into theData
put "center: new google.maps.LatLng("& fld "latlong" & ")," into line 38 of theData
//answer theData
put theData into URL ("file:" & thehtmlFile)
put "file://" & specialFolderPath("documents") & "/tt1.html" into theURL
replace space with "%20" in theURL
# create the browser
mobileControlCreate "browser"
put the result into browserID
# set up the basic defaults
mobileControlSet browserID, "rect", the rect of group "mybrowser"
mobileControlSet browserID, "visible", "true"
mobileControlSet browserID, "url", theURL
end preOpenCard
# destroy the browser we created
on closeCard
if the environment is not "mobile" then
exit closeCard
end if
mobileControlDelete browserID
end closeCard
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Reverse Geocoding</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
var geocoder;
var map;
var marker;
var infowindow = new google.maps.InfoWindow();
function initializeMap() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
revereGeoCode(position.coords.latitude, position.coords.longitude);
});
} else {
console.log("er")
// make sure to handle the failure
}
var mapOptions = {
zoom: 16,
center: new google.maps.LatLng(40.730885, -73.997383),
mapTypeId: 'roadmap'
}
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
function revereGeoCode(lat, lng) {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(lat, lng);
geocoder.geocode({
'latLng': latlng
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
// place your marker coding
map.setZoom(20);
// Define circle options
var circleOptions = {
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35,
map: map,
center: latlng,
radius: 20
};
// Add the circle to the map.
var markerCircle = new google.maps.Circle(circleOptions);
marker = new google.maps.Marker({
position: latlng,
map: map
});
infowindow.setContent(results[0].formatted_address);
infowindow.open(map, marker);
} else {
alert('No results found');
}
} else {
alert('Geocoder failed due to: ' + status);
}
});
}
//initializeMap();
google.maps.event.addDomListener(window, 'load', initializeMap);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
in the Ipad simulator the marker and circle show up.On the android device No.
i miss something here ?