Skip to content

Most visited

Recently visited

navigation

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.

The 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:

dependencies{
    ...
    wearApp project(':wear')
    compile 'com.google.android.gms:play-services-wearable:10.2.0'
    ...
}

The 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:2.0.2'
    compile 'com.google.android.gms:play-services-wearable:10.2.0'
}

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 'com.google.android.gms:play-services-location:10.2.0'

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.
This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.