Google Magnus Hyttsten Feb 13, 2014

New Client API Model in Google Play Services

Article Summary

Magnus Hyttsten from Google Developer Relations reveals a major shift in how Android developers connect to Google Play services. The old multi-client approach? Deprecated.

Google Play services 4.2 introduced a unified client API model that fundamentally changes how developers integrate multiple Google APIs. This post breaks down the new GoogleApiClient architecture that replaced the fragmented PlusClient, GamesClient approach.

Key Takeaways

Critical Insight

Google unified its Play services connection model into a single client that handles multiple APIs with one callback, dramatically simplifying Android integration code.

The enqueuing feature solves a specific timing problem that's plagued Android developers since the beginning of Google Play services.

About This Article

Problem

Developers had to manage separate callback methods for each API client like PlusClient and GamesClient. This split up state management and could interrupt sign-in mid-process, which hurt the user experience.

Solution

Magnus Hyttsten's team built the GoogleApiClient.Builder pattern with addApi() and addScope() methods. Developers could now declare all their API needs upfront, letting Google Play services handle user consent in one interaction instead of many.

Impact

The enqueuing feature lets API calls run in onStart and onResume lifecycle methods before the connection finishes. This removes the wait for separate callback methods and cuts down on boilerplate code.