diff --git a/docs/html/training/wearables/apps/creating-app-china.jd b/docs/html/training/wearables/apps/creating-app-china.jd new file mode 100644 index 0000000000000..d4b3ab74bc844 --- /dev/null +++ b/docs/html/training/wearables/apps/creating-app-china.jd @@ -0,0 +1,157 @@ +page.title=Creating Android Wear Apps for China +parent.title=Training +parent.link=creating.html +page.tags= "wearable", "apps", "china" +page.article=true + +@jd:body + +
google-play-services-7-8-87.zip
++Handsets sold in China do not have Google Play services preinstalled. For this reason, wearable +apps running on devices in China must communicate with paired handsets through the Android Wear +companion app. To enable you to develop a single APK that works with both Android Wear for China and + Android Wear in the rest of the world, we provide a special variant of the Google Play services +client library.
+ ++This client library is compatible with Android 4.3 (API level 18) and higher, and you can simply +drop it into your app. You do not need to write any new code. Instead, you change several project +configuration settings, and re-compile your app. +
+ + +The rest of this page explains how to perform this process.
+ + + ++
In order to support your wearable app on all handsets, you must download and add the Google Play +Services 7.8.87 client library as a Maven repository in your project, configure your +development project to use it, and re-compile your app. +
+ +The Google Play services 7.8.87 client library is distributed as a Maven repository. To add this +repository to your project:
+ ++The following example shows how to do so: +
+
+allprojects {
+ repositories {
+
+ maven {
+ url "${rootProject.projectDir}/google-play-services-7-8-87"
+ }
+ // ... other repositories may go here ...
+
+ }
+In the {@code build.gradle} file of your mobile module replace the Google Play + services dependency with a reference to the client library from the newly added repository. The + following example shows how to do so: +
+ + +
+dependencies{
+ ...
+ wearApp project(':wear')
+ compile 'com.google.android.gms:play-services-wearable:7.8.87'
+ ...
+ }
+
+The {@code build.gradle} file of your wear module must also use this version of the +client library, for example: +
+
+dependencies {
+ compile 'com.google.android.support:wearable:1.3.0'
+ compile 'com.google.android.gms:play-services-wearable:7.8.87'
+}
+
+
+Note: If you are using any other Google Play services APIs in your +wearable app, you must selectively add those Google Play service APIs into your app and explicitly + specify the 7.8.87 version. For example to include the Google location API in your wearable app, + add the following line in your {@code build.gradle} file: +
++compile 'com.google.android.gms:play-services-location:7.8.87' ++ +
You can now build +a new version of your app and deploy it to Android handsets globally.
+ + + ++If your app uses Google Play services APIs other than the Wearable API, then your app needs to check +whether these APIs are available to use during runtime and respond appropriately. There are two ways +to check the availability of Google Play service APIs: +
+ +To update your SDK with these components, see Get the latest SDK tools.
+Note: If you plan to make your Wear apps available for China, + you must use the special release version 7.8.87 of the Google Play services client library to handle + communication between handset and wearable. + + For information on how to configure Wear apps for China, see + Creating Android Wear Apps for + China.
We recommend that you develop on real hardware so you can better