I wanted to know if you can use a provider (through provideroptions
class) that is on your localhost. Here's some code to show how to
specify a new provider for gears to use. Problem is I keep getting
malformed response error.

Here's the json response:
{"location":{"latitude":20,"longitude":-60,"horizontal_accuracy":40}}
(I'm not actually using a json providing, just a static file on a
local webserver)

<html>
<head>
<script type="text/javascript" src="./gears_init.js"></script>
<script type="text/javascript">

var geo = google.gears.factory.create('beta.geolocation');

function updatePosition(position) {
  alert('Current lat/lon is: ' + position.latitude + ',' +
position.longitude );
}

function handleError(positionError) {
  alert('Attempt to get location failed: ' + positionError.message);
}

function init()
{
var providers = ["http://localhost:8080/json.json";];
var options = {gearsLocationProviderUrls:providers};
geo.getCurrentPosition(updatePosition, handleError, options);
}

</script>

</head>

<body onload="init()"> loaded

</body>
</html>

Reply via email to