diff --git a/docs/html/google/auth/api-client.jd b/docs/html/google/auth/api-client.jd index 5331d1ed9ab01..a0836d1dbd75c 100644 --- a/docs/html/google/auth/api-client.jd +++ b/docs/html/google/auth/api-client.jd @@ -15,6 +15,7 @@ startpage=true
  1. Handle connection failures
  2. Maintain state while resolving an error
  3. +
  4. Access the Wearable API
  • Communicate with Google Services @@ -104,7 +105,17 @@ additional calls to {@code addScope()}.

    -

    However, before you can begin a connection by calling +Important: To avoid client connection errors on devices that do not have the +Android +Wear app installed, use a separate {@code +GoogleApiClient} instance to access only the {@code +Wearable} API. For more information, see Access the Wearable +API.

    + +

    Before you can begin a connection by calling {@code connect()} on the {@code @@ -408,6 +419,45 @@ consult the corresponding documentation, such as for

    +

    Access the Wearable API

    + +

    On devices that do not have the Android +Wear app installed, connection requests that include the {@code +Wearable} API fail with the +API_UNAVAILABLE error code. If your app uses the {@code +Wearable} API in addition to other Google APIs, use a separate {@code +GoogleApiClient} instance to access the {@code +Wearable} API. This approach enables you to access other Google APIs on devices that are not +paired with a wearable device.

    + +

    When you use a separate {@code +GoogleApiClient} instance to access only the Wearable API, you can determine +whether the Android +Wear app is installed on the device:

    + +
    +// 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
    +    }
    +    ...
    +}
    +
    + + + +

    Communicate with Google Services

    diff --git a/docs/html/training/wearables/data-layer/accessing.jd b/docs/html/training/wearables/data-layer/accessing.jd index 36e3daaa9cd10..bffd4c8026411 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(); +

    +Important: To avoid client connection errors on devices that do not have the +Android +Wear app installed, use a separate {@code +GoogleApiClient} instance to access only the {@code +Wearable} API. For more information, see Access the Wearable API.

    +

    Before you use the data layer API, start a connection on your client by calling the connect() method, as described in