summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorRicardo Cervera <rcervera@google.com>2014-11-06 20:34:45 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-06 20:34:45 +0000
commitf90d9c235435116fbefc8b92f73553355ccec87e (patch)
tree199a8bdc391708811cfcfdd61e5ab247732267b7 /docs
parent1d270087a30a3610c56c65700f61c800a9797dc3 (diff)
parent0a285d4a3483011a57ecd4201db3fd38bb1d628f (diff)
downloadframeworks_base-f90d9c235435116fbefc8b92f73553355ccec87e.zip
frameworks_base-f90d9c235435116fbefc8b92f73553355ccec87e.tar.gz
frameworks_base-f90d9c235435116fbefc8b92f73553355ccec87e.tar.bz2
am 0a285d4a: am 9bc1b15a: am cc0753b0: docs: Add API_UNAVAILABLE case for Wear. Bug: 17753200
* commit '0a285d4a3483011a57ecd4201db3fd38bb1d628f': docs: Add API_UNAVAILABLE case for Wear. Bug: 17753200
Diffstat (limited to 'docs')
-rw-r--r--docs/html/google/auth/api-client.jd52
-rw-r--r--docs/html/training/wearables/data-layer/accessing.jd11
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
+&#64;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