Sunday, November 8, 2009

Creating Google gadgets with GWT - tutorial part 2

You should read part one before you continue here.

First lesson learned: you cannot get the HOST name of you gadget

String hostHost = Location.getHost().toLowerCase();
String hostName = Location.getHostName();

So I will be using URL parameters to set up my widget:

String gadget = Location.getParameter("gadget"); 

facebook4GWT API:

Creating Facebook gadgets in Google OpenSocial container does not work too well since you register the page on which Facebook app lives and in our case it is a Google server (e.g.


Facebook.addLoginHandler(new FacebookLoginHandler()
    public void loginStatusChanged(FacebookLoginEvent event)
if (event.isLoggedIn())
    facebookStatus.setText("Logged in");

    Facebook.APIClient().users_getLoggedInUser(new AsyncCallback()
public void onSuccess(FacebookUser result)

Solution for all this problems?

Use iFrame, I will investigate the best solutions in part 3 soon.