I solved the problem. First, you can talk to localhost. Second, your
provider CANNOT return integers for lat/long or you will get a
malformed response error.
Example
you can return 20.0 or just '20.' and they work. '20' does not. A bug
in the json parser.

On Oct 20, 12:11 pm, elcadar <[EMAIL PROTECTED]> wrote:
> 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