diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/html/google/auth/api-client.jd | 52 | ||||
-rw-r--r-- | docs/html/training/wearables/data-layer/accessing.jd | 11 |
2 files changed, 62 insertions, 1 deletions
diff --git a/docs/html/google/auth/api-client.jd b/docs/html/google/auth/api-client.jd index 5331d1e..a0836d1 100644 --- a/docs/html/google/auth/api-client.jd +++ b/docs/html/google/auth/api-client.jd @@ -15,6 +15,7 @@ startpage=true <ol> <li><a href="#HandlingFailures">Handle connection failures</a></li> <li><a href="#MaintainingState">Maintain state while resolving an error</a></li> + <li><a href="#WearableApi">Access the Wearable API</a></li> </ol> </li> <li><a href="#Communicating">Communicate with Google Services</a> @@ -104,7 +105,17 @@ additional calls to <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.Builder.html#addScope(com.google.android.gms.common.api.Scope)" >{@code addScope()}</a>.</p> -<p>However, before you can begin a connection by calling <a +<p class="caution"> +<strong>Important:</strong> To avoid client connection errors on devices that do not have the +<a href="https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en">Android +Wear app</a> installed, use a separate <a +href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code +GoogleApiClient}</a> instance to access only the <a +href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code +Wearable}</a> API. For more information, see <a href="#WearableApi">Access the Wearable +API</a>.</p> + +<p>Before you can begin a connection by calling <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()" >{@code connect()}</a> on the <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code @@ -408,6 +419,45 @@ consult the corresponding documentation, such as for </p> +<h3 id="WearableApi">Access the Wearable API</h3> + +<p>On devices that do not have the <a +href="https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en">Android +Wear app</a> installed, connection requests that include the <a +href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code +Wearable}</a> API fail with the <a +href="{@docRoot}reference/com/google/android/gms/common/ConnectionResult.html#API_UNAVAILABLE"> +<code>API_UNAVAILABLE</code></a> error code. If your app uses the <a +href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code +Wearable}</a> API in addition to other Google APIs, use a separate <a +href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code +GoogleApiClient}</a> instance to access the <a +href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code +Wearable}</a> API. This approach enables you to access other Google APIs on devices that are not +paired with a wearable device.</p> + +<p>When you use a separate <a +href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code +GoogleApiClient}</a> instance to access only the Wearable API, you can determine +whether the <a +href="https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en">Android +Wear app</a> is installed on the device:</p> + +<pre> +// Connection failed listener method for a client that only +// requests access to the Wearable API +@Override +public void onConnectionFailed(ConnectionResult result) { + if (result.getErrorCode() == ConnectionResult.API_UNAVAILABLE) { + // The Android Wear app is not installed + } + ... +} +</pre> + + + + <h2 id="Communicating">Communicate with Google Services</h2> diff --git a/docs/html/training/wearables/data-layer/accessing.jd b/docs/html/training/wearables/data-layer/accessing.jd index 36e3daa..bffd4c8 100644 --- a/docs/html/training/wearables/data-layer/accessing.jd +++ b/docs/html/training/wearables/data-layer/accessing.jd @@ -55,10 +55,21 @@ GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) Log.d(TAG, "onConnectionFailed: " + result); } }) + // Request access only to the Wearable API .addApi(Wearable.API) .build(); </pre> +<p class="caution"> +<strong>Important:</strong> To avoid client connection errors on devices that do not have the +<a href="https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en">Android +Wear app</a> installed, use a separate <a +href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code +GoogleApiClient}</a> instance to access only the <a +href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code +Wearable}</a> API. For more information, see <a +href="{@docRoot}google/auth/api-client.html#WearableApi">Access the Wearable API</a>.</p> + <p>Before you use the data layer API, start a connection on your client by calling the <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()">connect()</a> method, as described in |