Last Updated: February 19th, 2014

The recent release of Google Play Services 4.2 brought with it some exciting additions like the official Cast API and significantly improved support for Google Drive. One of the lesser publicized additions is the official launch of GoogleApiClient, a new component intended to simplify setting up and managing connections to Google's assorted API endpoints. Additionally, there is now support for queuing up read-only queries and a choice of executing calls synchronously or asynchronously.

A chief advantage of the new GoogleApiClient object is that it cuts out the need for multiple sets of callback methods and client objects for each distinct service (e.g. Drive, Games, Google+, etc). This will also make it easier to consolidate authorization requests for the user into a single prompt.


The GoogleApiClient isn't exactly brand new; it has been present in Play Services for some time, at least since early December. Like the APIs for Drive and Cast, the new client API model went through a testing phase as a "developer preview" before being deemed an officially supported part of the SDK.

Besides the new client API model, GMS also brought a couple of other great improvements. The SDK now supports queuing up read-only API calls when the connection is not yet active. This feature allows developers to make a request for data that will wait to be completed once a connection is established. The other major addition is support for asynchronous and synchronous API calls to Google services. When a method call is made, it returns a PendingResult object. To wait for the result before continuing with execution, simply add .await() to the end of the call and the thread will block until it completes.


With official support for GoogleApiClient, the older client objects belonging to each service have been officially deprecated. There is no specific date for the removal of the old APIs, but they will remain operational for a while, giving developers plenty of time to update their code. In many cases, the changes should only require modifications to a few lines of code and consolidating callback methods. For more details and samples, check out the blog post and detailed getting started documentation for Accessing Google Play Services APIs.

[Correction] Apps that rely on the older API will continue to work just fine, but they will be limited to older versions of the library. To use newer versions of the library will require switching over to GoogleApiClient. - Thanks, Shaftway!

Source: Android Developer Blog

Cody Toombs
Cody is a Software Engineer and Writer with a mildly overwhelming obsession with smartphones and the mobile world. If he’s been pulled away from the computer for any length of time, you might find him talking about cocktails and movies, sometimes resulting in the consumption of both.

  • ProductFRED
    • http://www.androidpolice.com/author/cody-toombs/ Cody Toombs

      No doubt :)

      Most of the time, I try really hard to make sure everybody can follow the topic. Not this time. This is just one of those subjects that just can't be simplified for non-developers, so I aimed at making it short and sweet for them.

      • Cerberus_tm

        Yeah I felt the same as the guy in the GIF, but I understood that it was something important for developers so I needn't be worried. Fine article as such.

      • Mike Reid

        Nice to see code in articles some times. :)

        For non-devs, please consider this a clue why not every app can be 99 cents or free.

      • http://www.LOVEanon.org/ Michael Oghia (Ogie)

        Thanks for covering it though @CodyToombs:disqus !

    • Fatty Bunter

      Perfect use of that gif, well done.

  • NaViTo

    LOL at ProductFRED comment, so true.

  • blackk

    Does anyone else feel a bit dizzy when looking at the code block? The text looks a bit odd.

  • DrakeTungsten

    I much prefer this to the "How to make a phone call" article on Android Central.

  • Shaftway

    Re: Apps needing to update - Existing apps will continue to run just fine. Apps only need to update if they want to start using newer versions of the library.

  • chowman

    actually, your edit/update made it even more misleading..shaftway had it right, but your summary mutilated the gist :)

    "[Correction] Apps that rely on the older API will continue to work
    just fine, but they will be limited to older versions of the library. To
    use newer versions of the library will require switching over to

    that implies that backwards compatibility was broken, and that the deprecated methods were removed in newer versions of the library.

    The reality is that newer versions of the lib only the *add* the new method, they don't remove the old. There's a *big* difference, if google removed the method and offered no backwards compatible way for app devs to interact with such things, they would completely b@stardize their adoption rates for anything new...(e.g. look at the android compatibility library, which supports new things but has fallbacks for older devices since gingerbread, which makes it easy).