Closed GoogleCodeExporter closed 9 years ago
Workaround:
For now, if you want to do this, use JSNI methods similar to the following:
public static double getClientLatitde() /*-{
return (ClientLocation == null ? 0 : Number(ClientLocation.latitude));
}-*/;
public static double getClientLongitude() /*-{
return (ClientLocation == null ? 0 : Number(ClientLocation.longitude));
}-*/;
Original comment by galgwt.reviews@gmail.com
on 23 Aug 2008 at 2:10
Thanks, but I'm definitively missing something since I get this error at
runtime:
com.google.gwt.core.client.JavaScriptException: (TypeError): 'ClientLocation' is
undefined (or 'google' is undefined when I try google.loader.ClientLocation)
I've included the api in two ways (I'm using r290 jar, I don't know which way to
include is the right, but both seems to have the right structures):
http://www.google.com/uds/api?file=uds.js&v=1.0&key=ABC
and
http://www.google.com/jsapi?key=ABCC
I tried including the gwt Ajax Search jar, with in my module.gwt.xml :
<inherits name="com.google.gwt.ajaxsearch.AjaxSearch" />
I've also tried to include this script :
google.load("search", "1");
Original comment by mehdi.ra...@gmail.com
on 23 Aug 2008 at 8:41
Sorry, that should have been $wnd.ClientLocation in every instance.
From what I read, you must load it with the ajaxloader style
(www.google.com/jsapi)
Also, if you don't have a real key, get rid of the key=ABC part.
Original comment by galgwt.reviews@gmail.com
on 23 Aug 2008 at 10:58
thanks for the help, it's better but it's not working as expected.
the result is 0, which should mean that ClientLocation is null.
but when I type google.com/jsapi in my browser, I have the right informations
any ideas ?
btw I use a real key (I also tried without, but it shouldn't matter I work in
web
hosted mode/localhost)
Original comment by mehdi.ra...@gmail.com
on 23 Aug 2008 at 11:31
Please try posting to the public group for GWT or AJAX Loader for more help
with this.
Original comment by galgwt.reviews@gmail.com
on 23 Aug 2008 at 11:36
ok nvm, I had this code working:
public class ClientLocalization {
public static native double getClientLatitude() /*-{
return ($wnd.google.loader.ClientLocation == null ? 0 :
Number($wnd.google.loader.ClientLocation.latitude));
}-*/;
public static native double getClientLongitude() /*-{
return ($wnd.google.loader.ClientLocation == null ? 0 :
Number($wnd.google.loader.ClientLocation.longitude));
}-*/;
}
Original comment by mehdi.ra...@gmail.com
on 24 Aug 2008 at 10:37
Original comment by galgwt.reviews@gmail.com
on 12 Jan 2009 at 3:41
Original comment by galgwt.reviews@gmail.com
on 12 Jan 2009 at 3:42
Released 1.0.0 version
Original comment by galgwt.reviews@gmail.com
on 18 May 2009 at 8:28
Original comment by zundel@google.com
on 21 Dec 2009 at 1:57
I had the same issue before and a simple check of the type of the google var
helps a ton, therefore it doesn't help on the natural behavior of the library.
As a note, I only have this issue with IE 9. Works perfectly for mobile
browsers, FF, Chrome and Safari.
Original comment by mcloide1...@gmail.com
on 7 Nov 2011 at 3:39
:) your google object is not loaded completely and code starts using it. Make
sure google api js is completely loaded and then use it.
Original comment by bkbm...@gmail.com
on 28 Jun 2012 at 5:04
Original issue reported on code.google.com by
mehdi.ra...@gmail.com
on 23 Aug 2008 at 1:48