page.title=Downloading and Configuring the Google Play services SDK @jd:body
The Google Play services SDK is an extension to the Android SDK and is available to you as a downloadable SDK component. This download includes the client library and code samples.
Before you get started developing, make sure that you have an updated version of the Android SDK installed on your computer, including the SDK Tools component. If you don't have the SDK, visit the SDK Download page on the Android Developers site.
To download and configure the Google Play services SDK:
android
at the command line.
<android-sdk-folder>/extras/google/google_play_services/
.
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib
as
a library project for your Android project. See the
Referencing a Library Project for Eclipse
or Referencing a Library Project on the Command Line
for more information on how to do this.
<project_directory>/proguard-project.txt
file:
to prevent ProGuard from stripping away required classes:
-keep class * extends java.util.ListResourceBundle { protected Object[][] getContents(); }
Google Play delivers updates to the majority of the devices that support Google Play services (Android 2.2 devices with the Google Play Store app installed). However, updates might not reach supported devices in a timely manner, which are desribed in the following four scenarios:
Important: Because it is hard to anticipate the state devices are in, you must always check for a compatible Google Play services APK in your app when you are accessing Google Play services features. For many apps, this is each time in the {@link android.app.Activity#onResume onResume()} method of the main activity.
Case 1 is the success scenario and is the most common. However, because the other scenarios can still happen, you must handle them every time your app connects to a Google Play service to ensure that the Google Play services APK is present, up-to-date, and enabled.
To help you, the Google Play services client library has utility methods to assist in determining whether or not the Google Play services APK is recent enough to support the version of the client library that you are using. If not, the client library sends users to the Google Play Store to download a recent version of the Google Play services APK.
Note: The Google Play services APK is not visible by searching the Google Play Store. The client library provides a deep link into the Google Play Store when it detects that the device has a missing or incompatible Google Play services APK.
It is up to you choose the appropriate place in your app to do the following steps to check for a valid Google Play services APK. For example, if Google Play services is required for your app, you might want to do it when your app first launches. On the other hand, if Google Play services is an optional part of your app, you can do these checks if the user navigates to that portion of your app: