Merge "Revert "docs: Updated 'What's New' in Google Play services doc to reflect changes in GMS v7.0 (Orla). This content is scheduled to be published with the Orla SDK release."" into lmp-docs
This commit is contained in:
committed by
Android (Google) Code Review
commit
5a5e6a3701
@@ -52,7 +52,8 @@ for REST APIs</a>.</p>
|
||||
|
||||
<p class="note">
|
||||
<strong>Note:</strong> If you have an existing app that connects to Google Play services with a
|
||||
subclass of {@code GooglePlayServicesClient}, you should migrate to <a
|
||||
subclass of <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.html">{@code GooglePlayServicesClient}</a>, you should migrate to <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code
|
||||
GoogleApiClient}</a> as soon as possible.</p>
|
||||
|
||||
@@ -132,9 +133,7 @@ succeeds, fails, or becomes suspended.</p>
|
||||
API Client:</p>
|
||||
|
||||
<pre>
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
|
||||
import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
|
||||
import gms.common.api.*;
|
||||
import gms.drive.*;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
@@ -207,18 +206,20 @@ href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html
|
||||
|
||||
<p>However, if you run this code, there's a good chance it will fail and your app will receive a call
|
||||
to <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
>{@code onConnectionFailed()}</a> with the <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SIGN_IN_REQUIRED"
|
||||
>{@code SIGN_IN_REQUIRED}</a> error because the user account
|
||||
has not been specified. The next section shows how to handle this error and others.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<h3 id="HandlingFailures">Handle connection failures</h3>
|
||||
|
||||
<p>When you receive a call to the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)">
|
||||
{@code onConnectionFailed()}</a> callback, you should call <a
|
||||
<p>When you receive a call to the <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
>{@code onConnectionFailed()}</a> callback, you should call <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#hasResolution()"
|
||||
>{@code hasResolution()}</a> on the provided <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html"
|
||||
@@ -243,9 +244,8 @@ dialog may simply provide a message explaining the error, but it may also provid
|
||||
launch an activity that can resolve the error (such as when the user needs to install a newer
|
||||
version of Google Play services).</p>
|
||||
|
||||
<p>For example, your
|
||||
<a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
<p>For example, your <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
>{@code onConnectionFailed()}</a> callback method should now look like this:</p>
|
||||
|
||||
<pre>
|
||||
@@ -365,9 +365,9 @@ if retained across activity instances, though. The next section explains further
|
||||
|
||||
<h3 id="MaintainingState">Maintain state while resolving an error</h3>
|
||||
|
||||
<p>To avoid executing the code in
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)">
|
||||
{@code onConnectionFailed()}</a> while a previous attempt to resolve an
|
||||
<p>To avoid executing the code in <a
|
||||
href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)"
|
||||
>{@code onConnectionFailed()}</a> while a previous attempt to resolve an
|
||||
error is ongoing, you need to retain a boolean that tracks whether your app is already attempting
|
||||
to resolve an error.</p>
|
||||
|
||||
|
||||
@@ -52,8 +52,11 @@ your app with the most recent version of Google Play services without worrying
|
||||
about your users' Android version.</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<p>To start integrating Google Play services into your app,
|
||||
follow the <a href="/google/play-services/setup.html">Setup</a> guide.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<h2 style="margin-top:0" id="newfeatures">New Features</h2>
|
||||
@@ -62,125 +65,6 @@ about your users' Android version.</p>
|
||||
<p><a href="#" onclick="return toggleContent(this)">
|
||||
<img src="{@docRoot}assets/images/triangle-opened.png"
|
||||
class="toggle-content-img"
|
||||
alt=""/>Google Play services, Version 7.0</a> <em>(March 2015)</em>
|
||||
</p>
|
||||
|
||||
<div class="toggle-content-toggleme">
|
||||
<dl>
|
||||
<dt>Highlights in Version 7.0</dt>
|
||||
<dd>
|
||||
<p>For a summary of the feature highlights in Google Play services 7.0, see the
|
||||
announcement
|
||||
<a href="http://android-developers.blogspot.com/2015/03/google-play-services-70-places-everyone.html"
|
||||
class="external-link">blog post</a>.</p>
|
||||
<ul>
|
||||
<li><strong>Places</strong> - Using the Google Places API for Android, you can build
|
||||
location-aware apps that respond contextually to the local businesses and other places near
|
||||
the device. Use the built-in place picker UI widget and API methods to find the device’s
|
||||
current place, autocomplete users’ queries, and more.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/places/documentation/android/"
|
||||
class="external-link">Places API developer guide</a></li>
|
||||
<li><a href="{@docRoot}reference/com/google/android/gms/location/places/package-summary.html">
|
||||
Places API reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Location settings</strong> - While the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html">
|
||||
{@code FusedLocationProviderApi}</a>
|
||||
combines multiple sensors to give you the optimal location, the accuracy of the location your
|
||||
app receives still depends greatly on the settings enabled on the device (GPS, wifi, airplane
|
||||
mode, and others). Using the new
|
||||
<a href="{@docRoot}reference/com/google/android/gms/location/SettingsApi.html">
|
||||
{@code SettingsApi}</a>
|
||||
class, you can bring up a Location Settings dialog which displays a one-touch control for users
|
||||
to change their settings without leaving your app.
|
||||
</li>
|
||||
<li><strong>Fit</strong> - The Google Fit API is now more efficient with modular calls to specific
|
||||
functionality within the API. You can now also access distance and granular sleep data.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/fit/android/get-started.html#step_5_connect_to_the_fitness_service"
|
||||
class="external-link">Fit API developer guide</a></li>
|
||||
<li><a href="{@docRoot}reference/com/google/android/gms/fitness/package-summary.html">
|
||||
Fit API reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Google Mobile Ads</strong> - This release introduces the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/ads/doubleclick/PublisherAdRequest.Builder.html#addCustomTargeting(java.lang.String,%20java.lang.String)">
|
||||
{@code addCustomTargeting()}</a>
|
||||
and <a href="{@docRoot}reference/com/google/android/gms/ads/doubleclick/PublisherAdRequest.Builder.html#addCategoryExclusion(java.lang.String)">
|
||||
{@code addCategoryExclusion()}</a>
|
||||
methods to the <a href="{@docRoot}reference/com/google/android/gms/ads/doubleclick/PublisherAdRequest.Builder.html">
|
||||
{@code PublisherAdRequest.Builder} </a>
|
||||
class, enabling DoubleClick for Publishers (DFP) developers to
|
||||
<a href="https://support.google.com/dfp_sb/answer/112648" class="external-link">target custom
|
||||
criteria</a>
|
||||
and <a href="https://support.google.com/dfp_premium/answer/2627086" class="external-link">use
|
||||
ad exclusions to block ads</a>.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/mobile-ads-sdk/docs/dfp/android/banner"
|
||||
class="external-link">DFP targeting developer guide</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Play Game services</strong> - The Nearby Connections API allows users to connect to
|
||||
each other and exchange messages over a local network. This API supports local multiplayer
|
||||
and second screen gaming.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/games/services/android/nearby.html"
|
||||
class="external-link">Nearby Connections developer guide</a></li>
|
||||
<li><a href="{@docRoot}reference/com/google/android/gms/nearby/connection/package-summary.html">
|
||||
Nearby Connection API reference</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>Google API client</strong> - This release introduces the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#requestServerAuthCode(java.lang.String,%20com.google.android.gms.common.api.GoogleApiClient.ServerAuthCodeCallbacks)">{@code GoogleApiClient.Builder.requestServerAuthCode()}</a> method. This API makes it significantly easier
|
||||
to enable servers to be able to make Google API calls on behalf of users. This method reduces
|
||||
the lines of boilerplate code that you previously had to implement.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/identity/sign-in/android/sign-in.html#enable_server-side_api_access_for_your_app"
|
||||
class="external-link">Server-side API access developer guide</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Drive</strong> - This release adds
|
||||
<a href="{@docRoot}reference/com/google/android/gms/drive/DriveResource.html#trash(com.google.android.gms.common.api.GoogleApiClient))">
|
||||
{@code trash()}</a> and
|
||||
<a href="{@docRoot}reference/com/google/android/gms/drive/DriveResource.html#untrash(com.google.android.gms.common.api.GoogleApiClient)">
|
||||
{@code untrash()}</a> methods to the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/drive/DriveResource.html">
|
||||
{@code DriveResource}</a>
|
||||
class. These methods enable you to move user-visible files and folders to the trash or
|
||||
restore them from the trash. Trashing a folder recursively trashes its children. The
|
||||
<a href="{@docRoot}reference/com/google/android/gms/drive/Metadata.html#isExplicitlyTrashed()">
|
||||
{@code isExplicitlyTrashed()}</a> method indicates whether a resource was trashed directly,
|
||||
or as the result of a trashed parent.
|
||||
<ul>
|
||||
<li><a href="https://developers.google.com/drive/android/trash.html"
|
||||
class="external-link">Trashing and untrashing developer guide</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>SafetyNet API</strong> - The API lets you check if your app is running on a device
|
||||
that matches a device model that has passed Android compatibility testing. The API evaluates
|
||||
both software and hardware characteristics of a device to determine whether it matches a
|
||||
known-good configuration that has been previously determined to be compatible. You can use the
|
||||
SafetyNet API in conjunction with other tools to determine whether the device appears capable
|
||||
of handling specific features in your app.
|
||||
<ul>
|
||||
<li><a href="{@docRoot}reference/com/google/android/gms/safetynet/package-summary.html">
|
||||
SafetyNet API reference</a></li>
|
||||
<li><a href="{@docRoot}google/play/safetynet/index.html">
|
||||
SafetyNet developer guide</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toggle-content closed">
|
||||
<p><a href="#" onclick="return toggleContent(this)">
|
||||
<img src="{@docRoot}assets/images/triangle-closed.png" class="toggle-content-img"
|
||||
alt=""/>Google Play services, Version 6.5</a> <em>(December 2014)</em>
|
||||
</p>
|
||||
|
||||
@@ -270,8 +154,6 @@ enables you to get a ready-to-use Street View panorama.
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toggle-content closed">
|
||||
<p><a href="#" onclick="return toggleContent(this)">
|
||||
|
||||
@@ -67,7 +67,7 @@ apply plugin: 'com.android.application'
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||
<strong>compile 'com.google.android.gms:play-services:7.0.0'</strong>
|
||||
<strong>compile 'com.google.android.gms:play-services:6.5.87'</strong>
|
||||
}
|
||||
</pre>
|
||||
<p>Be sure you update this version number each time Google Play services is updated.</p>
|
||||
@@ -106,14 +106,14 @@ example, to include only the Google Fit and Android Wear APIs, replace the follo
|
||||
<code>build.gradle</code> file:</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
compile 'com.google.android.gms:play-services:7.0.0'
|
||||
compile 'com.google.android.gms:play-services:6.5.87'
|
||||
</pre>
|
||||
|
||||
<p>with these lines:</p>
|
||||
|
||||
<pre class="no-pretty-print">
|
||||
compile 'com.google.android.gms:play-services-fitness:7.0.0'
|
||||
compile 'com.google.android.gms:play-services-wearable:7.0.0'
|
||||
compile 'com.google.android.gms:play-services-fitness:6.5.87'
|
||||
compile 'com.google.android.gms:play-services-wearable:6.5.87'
|
||||
</pre>
|
||||
|
||||
<p>Table 1 shows a list of the separate APIs that you can include when compiling your app, and
|
||||
@@ -129,78 +129,67 @@ you include an API that does have a separate library.)</p>
|
||||
<th scope="col">Google Play services API</th>
|
||||
<th scope="col">Description in <code>build.gradle</code></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>Google+</td>
|
||||
<td>com.google.android.gms:play-services-plus:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-plus:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Account Login</td>
|
||||
<td>com.google.android.gms:play-services-identity:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-identity:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Actions, Base Client Library</td>
|
||||
<td>com.google.android.gms:play-services-base:7.0.0</td>
|
||||
<td>Google Activity Recognition</td>
|
||||
<td>com.google.android.gms:play-services-location:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google App Indexing</td>
|
||||
<td>com.google.android.gms:play-services-appindexing:7.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Analytics</td>
|
||||
<td>com.google.android.gms:play-services-analytics:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-appindexing:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Cast</td>
|
||||
<td>com.google.android.gms:play-services-cast:7.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Cloud Messaging</td>
|
||||
<td>com.google.android.gms:play-services-gcm:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-cast:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Drive</td>
|
||||
<td>com.google.android.gms:play-services-drive:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-drive:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Fit</td>
|
||||
<td>com.google.android.gms:play-services-fitness:7.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Location, Activity Recognition, and Places</td>
|
||||
<td>com.google.android.gms:play-services-location:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-fitness:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Maps</td>
|
||||
<td>com.google.android.gms:play-services-maps:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-maps:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Mobile Ads</td>
|
||||
<td>com.google.android.gms:play-services-ads:7.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Nearby</td>
|
||||
<td>com.google.android.gms:play-services-nearby:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-ads:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Panorama Viewer</td>
|
||||
<td>com.google.android.gms:play-services-panorama:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-panorama:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Play Game services</td>
|
||||
<td>com.google.android.gms:play-services-games:7.0.0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SafetyNet</td>
|
||||
<td>com.google.android.gms:play-services-safetynet:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-games:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Google Wallet</td>
|
||||
<td>com.google.android.gms:play-services-wallet:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-wallet:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Android Wear</td>
|
||||
<td>com.google.android.gms:play-services-wearable:7.0.0</td>
|
||||
<td>com.google.android.gms:play-services-wearable:6.5.87</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Google Actions<br>
|
||||
Google Analytics<br>
|
||||
Google Cloud Messaging<br>
|
||||
</td>
|
||||
<td>com.google.android.gms:play-services-base:6.5.87</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div><!-- end studio -->
|
||||
@@ -210,14 +199,13 @@ you include an API that does have a separate library.)</p>
|
||||
<p>To make the Google Play services APIs available to your app:</p>
|
||||
<ol>
|
||||
<li>Copy the library project at
|
||||
{@code <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/}
|
||||
<code><android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/</code>
|
||||
to the location where you maintain your Android app projects.</li>
|
||||
<li>Import the library project into your Eclipse workspace. Click
|
||||
<b>File > Import</b>, select <b>Android > Existing Android Code into
|
||||
Workspace</b>, and browse to the copy of the library project to import it.</li>
|
||||
<li>In your app project, reference Google Play services library project. See
|
||||
<a href="{@docRoot}tools/projects/projects-eclipse.html#ReferencingLibraryProject">
|
||||
Referencing a Library Project for Eclipse</a> for more information on how to
|
||||
<a href="{@docRoot}tools/projects/projects-eclipse.html#ReferencingLibraryProject">Referencing a Library Project for Eclipse</a> for more information on how to
|
||||
do this.
|
||||
<p class="note"><strong>Note:</strong> You should be referencing a copy of the
|
||||
library that you copied to your development workspace—you should not
|
||||
@@ -244,9 +232,7 @@ you can begin developing features with the
|
||||
|
||||
<p>To make the Google Play services APIs available to your app:</p>
|
||||
<ol>
|
||||
<li>Copy the library project at
|
||||
{@code <android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/}
|
||||
to the location where you maintain your Android app projects.</li>
|
||||
<li>Copy the library project at <code><android-sdk>/extras/google/google_play_services/libproject/google-play-services_lib/</code> to the location where you maintain your Android app projects.</li>
|
||||
|
||||
<li>In your app project, reference the Google Play services library project. See
|
||||
<a href="{@docRoot}tools/projects/projects-cmdline.html#ReferencingLibraryProject">Referencing
|
||||
@@ -258,8 +244,7 @@ workspace—you should not reference the library directly from the Android S
|
||||
<li>After you've added the Google Play services library as a dependency for
|
||||
your app project, open your app's manifest file and add the following tag as
|
||||
a child of the
|
||||
<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a>
|
||||
element:
|
||||
<a href="{@docRoot}guide/topics/manifest/application-element.html">{@code <application>}</a> element:
|
||||
<pre>
|
||||
<meta-data android:name="com.google.android.gms.version"
|
||||
android:value="@integer/google_play_services_version" />
|
||||
@@ -317,39 +302,23 @@ perform API transactions.</p>
|
||||
<strong>Important:</strong>
|
||||
Because it is hard to anticipate the state of each device, you must <em>always</em> check for a
|
||||
compatible Google Play services APK before you access Google Play services
|
||||
features.
|
||||
features. For many apps, the best time to check is during the
|
||||
{@link android.app.Activity#onResume onResume()} method of the main activity.
|
||||
</p>
|
||||
|
||||
<p>The Google Play services library includes utility methods that help you determine whether or not
|
||||
the Google Play services version on the device supports the version of the client library you are
|
||||
using. If the version on the device is too old, the system will take the user to Google Play Store
|
||||
in order to install the recent version of the Google Play services.</p>
|
||||
|
||||
<p>Because each app uses Google Play services differently, it's up to you decide the appropriate
|
||||
place in your app to verify the Google Play services version. For example, if Google Play
|
||||
place in your app to check verify the Google Play services version. For example, if Google Play
|
||||
services is required for your app at all times, 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 check
|
||||
the version only once the user navigates to that portion of your app.</p>
|
||||
|
||||
<p>You are strongly encouraged to use the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">
|
||||
{@code GoogleApiClient}</a> class to access Google Play services features. This approach allows
|
||||
you to attach an
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html">
|
||||
{@code OnConnectionFailedListener}</a> object to your client.
|
||||
To detect if the device has the appropriate version of the Google Play services APK, implement the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html#onConnectionFailed(com.google.android.gms.common.ConnectionResult)">
|
||||
{@code onConnectionFailed()}</a>
|
||||
callback method. If the connection fails due to a missing or out-of-date version of
|
||||
the Google Play APK, the callback receives an error code such as
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SERVICE_MISSING">
|
||||
{@code SERVICE_MISSING}</a>,
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SERVICE_VERSION_UPDATE_REQUIRED">
|
||||
{@code SERVICE_VERSION_UPDATE_REQUIRED}</a>, or
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SERVICE_DISABLED">
|
||||
{@code SERVICE_DISABLED}</a>. To learn more about how to build your client and handle such
|
||||
connection errors, see <a href="{@docRoot}google/auth/api-client.html">Accessing Google APIs</a>.
|
||||
</p>
|
||||
|
||||
<p>Another approach is to use the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#isGooglePlayServicesAvailable(android.content.Context)"
|
||||
>{@code isGooglePlayServicesAvailable()}</a> method. You might call this method in the
|
||||
{@link android.app.Activity#onResume onResume()} method of the main activity. If the result code is
|
||||
<p>To verify the Google Play services version, call <a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#isGooglePlayServicesAvailable(android.content.Context)"
|
||||
>{@code isGooglePlayServicesAvailable()}</a>. If the result code is
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SUCCESS"
|
||||
>{@code SUCCESS}</a>,
|
||||
then the Google Play services APK is up-to-date and you can continue to make a connection.
|
||||
@@ -360,11 +329,12 @@ If, however, the result code is
|
||||
>{@code SERVICE_VERSION_UPDATE_REQUIRED}</a>,
|
||||
or
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#SERVICE_DISABLED"
|
||||
>{@code SERVICE_DISABLED}</a>, then the user needs to install an update. In this case, call the
|
||||
<a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#getErrorDialog(int, android.app.Activity, int)">
|
||||
{@code getErrorDialog()}</a> method and pass it the result error code. The method returns a
|
||||
{@link android.app.Dialog} you should show, which provides an appropriate message about the error
|
||||
and provides an action that takes the user to Google Play Store to install the update.</p>
|
||||
>{@code SERVICE_DISABLED}</a>, then the user needs to install an update. So,
|
||||
call <a href="{@docRoot}reference/com/google/android/gms/common/GooglePlayServicesUtil.html#getErrorDialog(int, android.app.Activity, int)"
|
||||
>{@code GooglePlayServicesUtil.getErrorDialog()}</a> and pass it the result error code.
|
||||
This returns a {@link android.app.Dialog} you should show, which provides an appropriate message
|
||||
about the error and provides an action
|
||||
that takes the user to Google Play Store to install the update.</p>
|
||||
|
||||
|
||||
<p>To then begin a connection to Google Play services (required by most Google APIs such
|
||||
|
||||
Reference in New Issue
Block a user