Creating Android Wear Apps for China

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, you must use a compatible version 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.

Support Your App on Android Wear for China

In order to support your wearable app on all handsets, you must configure your project to use version 10.2.0 of the Google Play Services client library and re-compile your app.

Configure your app to use the correct version of Google Play Services

In the build.gradle file of your mobile module replace the Google Play services dependency with a reference to the 10.2.0 version. The following example shows how to do so:

            wearApp project(':wear')
            compile ''

The build.gradle file of your wear module must also use this version of the client library, for example:

dependencies {
        compile ''
        compile ''

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 10.2.0 version. For example to include the Google location API in your wearable app, add the following line in your build.gradle file:

compile ''

Build the project

You can now build a new version of your app and deploy it to Android handsets globally.

Use Other Google Play services APIs

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:

  1. Use a separate GoogleApiClient instance for connecting to other APIs. This interface contains callbacks to alert your app to the success or failure of the connection. To learn how to handle connection failures, see Accessing Google APIs.
  2. Use the addApiIfAvailable() method of GoogleApiClient.Builder to connect to the required APIs. After the onConnected() callback fires, check if each of the requested API is connected correctly using the hasConnectedApi() method.