Wednesday, 2 October 2013

Google+ client changes in Google Play Services 3.2

The latest update to the Google Play Services client library on the 20th of September had a couple of Google+ changes in it that the docs were a bit slow to reflec. Though they're now all up to date, I wanted to quickly highlight the changes in a post as well, for anyone looking at the client library.

PlusOneButton no longer requires PlusClient

No longer do you have to worry about calling clearScopes() on your PlusClient before creating a +1 button in an Android app. The PlusClient argument has been removed from the initialize methods on the PlusOneButton class, which means creating a +1 button is now as easy as adding it to your layout file:

We set up the button by calling the initialize function with a URL, and either a request code or a click listener.

loadPerson is dead, long live getCurrentPerson

The people loading functions were simplified as well. The PlusClient.OnPersonLoadedListener interface and the PlusClient.loadPerson method have both been removed. For loading people, the PlusClient.OnPeopleLoadedListener interface and the PlusClient.loadPeople methods are still there, and allow you to retrieve one or more people by user ID, as described in the loadPeople docs. However, for the common case of getting details about the signed-in user, the best idea is to use getCurrentPerson. This gets populated as part of the sign-in process, so should be the quickest and simplest way of getting the user's profile:

Thanks to +Gerwin Sturm and +Stephan Linzner for the pings about the documentation, and to +Brett Johnson for getting it updated super quickly!