Google is committed to advancing racial equity for Black communities. See how.

Wear OS apps run directly on a watch, giving you access to hardware such as sensors and the GPU. Wearable apps are similar to other apps that use the Android SDK, but differ in design and functionality.

A Wear app should work independently of a phone app, allowing users the greatest flexibility in their choice of phones. For more information, see Standalone Apps.

Note: You can test your app on an actual watch by connecting to the watch via Wi-Fi or Bluetooth. Development with an actual watch enables you to better evaluate the total user experience. A watch emulator also is available. You can use the watch emulator in Android Studio to test your app with different screen shapes and sizes.

Set up your environment

Install the latest version of Android Studio. For information about creating apps in Android Studio, see Projects overview.

Use the SDK manager to confirm that you have the latest version of the Android platform. Specifically, under the SDK Platforms tab, select Android 8.0 (Oreo).

If you plan to make your Wear OS apps available for China, see Create Wear OS apps for China.

Create a Wear OS app

You can create a Wear OS app using Android Studio's New Project wizard.

Start a Wear OS project

To create a project in Android Studio:

Click File > New > New Project. On the Configure your new project screen, accept the default values and click Next. On the Target Android Devices screen, select only the Wear option, and in the Minimum SDK list, select the latest available option. Click Next, and on the Add an Activity to Wear screen, select Blank Wear Activity and click Next. On the Customize the Activity screen, click Finish. Android Studio uses its templates to create an app. In the build.gradle file for the app module: In the android section, confirm that the compileSdkVersion is set to 28.

section, confirm that the is set to 28. In the android section, confirm that the targetSdkVersion is set to 28.

section, confirm that the is set to 28. Update the dependencies section. The first dependency is for the Wear UI Library, which has classes that exemplify best practices. The second dependency is for the Wearable Support Library, which has additional classes (including for watch faces): dependencies { implementation 'androidx.wear:wear:1.0.0' implementation 'com.google.android.support:wearable:2.7.0' compileOnly 'com.google.android.wearable:wearable:2.7.0' } In the Android Manifest file ( AndroidManifest.xml ) of your app, indicate that your app is standalone. Specifically, add a meta-data tag as follows: Find the <application> tag.

tag. As a child of that tag, use a meta-data tag with a name of com.google.android.wearable.standalone and a value of true : <application> ... <meta-data android:name="com.google.android.wearable.standalone" android:value="true" /> ... </application> In the Android Manifest file, ensure the <uses-feature> tag is defined. At a minimum, it must be defined with android:name="android.hardware.type.watch" as follows: <manifest> ... <uses-feature android:name="android.hardware.type.watch" /> ... </manifest> Sync your Android Studio project. To run the code in the new module, see Launch the emulator and run your Wear OS app.

Launch the emulator and run your Wear OS app

To use the emulator, you must configure an Android Virtual Device, referred to as an AVD. Confirm that you have the latest version of the Android SDK Platform-tools from the SDK Manager.

Configure an AVD and run your app as follows:

In Android Studio, open the Android Virtual Device Manager by selecting Tools > AVD Manager. Click Create Virtual Device. In the Category pane, select Wear and choose a hardware profile. Click Next. Select the Pie image to download. For example, select the image with the Release Name of Pie, the API Level of 28, and the Target of "Android 9.0 (Wear OS)". Click Next and then click Finish. Close the Android Virtual Device Manager. In the Android Studio toolbar, select the AVD you just created from the target device drop-down menu, then click Run . The AVD starts and, after a few moments, runs your app. A "Hello..." message is displayed.

For more information about using AVDs, see Run apps on the Android emulator.

Pair a phone with the watch AVD

Note: Pairing the watch AVD with a phone AVD is unsupported. You must pair to a connected phone.

If you want a Google Account on the watch AVD for development, you can pair a phone with the watch AVD and sync a Google Account:

Follow the steps for setting up a phone. On the phone, enable Developer Options and USB Debugging. Connect the phone to your computer through USB. Forward the AVD's communication port to the connected phone (each time the phone is connected):

adb -d forward tcp:5601 tcp:5601 On the phone, in the Wear OS app, begin the standard pairing process. For example, on the Welcome screen, tap the Set It Up button. Alternatively, if an existing watch already is paired, in the upper-left drop-down, tap Add a New Watch. On the phone, in the Wear OS app, tap the Overflow button, and then tap Pair with Emulator. Tap the Settings icon. Under Device Settings, tap Emulator. Tap Accounts and select a Google Account, and follow the steps in the wizard to sync the account with the emulator. If necessary, type the screen-lock device password, and Google Account password, to start the account sync.

If you have an existing project, you may need to update your build.gradle file. Version 4.1 of Gradle supports the use of google() for indicating the Google Maven repository; prior versions of Gradle do not. For related information, see Google's Maven repository.

Thus, if your Gradle version is lower than 4.1, provide the Google Maven repository URL in the build.gradle file for your Android Studio project. Specifically, in the repositories section, add a maven section as follows:

allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } }

Set up a watch

Deploying an app to a watch is similar to deploying an app to a phone.

This section assumes that your watch has a USB port. If your watch lacks a USB port, see the instructions for connecting your watch via Wi-Fi or Bluetooth.

Enable adb debugging on the watch:

Open the Settings menu on the watch. Scroll to the bottom of the menu. If no Developer options item is provided, tap System and then About. Tap the build number 7 times. From the Settings menu, tap Developer options. Enable ADB debugging.

Connect the watch:

Connect the watch to your machine through USB, so you can install apps directly to the watch. Alternatively, connect the watch to your machine over Wi-Fi or Bluetooth. On the watch, tap Always allow from this computer and tap OK.

After you connect the watch, run your app by selecting a deployment target as you would with a phone.

Set up a phone

This section contains information about setting up a companion phone with an Wear OS companion app.

Note: Wear OS apps should be standalone, and work independently of a phone. However, if your app depends on a phone app, see the information below about updating a phone with the latest Wear OS companion app.

Use the Android version of the companion app

On an Android phone, go to the Wear OS app listing. Tap Update to download and install the app. After installation, confirm that Auto-update is selected for the app (see the "Set up automatic updates for specific apps" section of Update downloaded apps). Tap Open to start the app.

Pair an Android phone to a watch

After you install the companion app on a phone, unpair ("Forget") any obsolete watch pairings, if necessary. Then you can pair the phone to a newly-imaged watch:

On the phone, select your device name from the list of devices. A pairing code is displayed on the phone and on the watch. Ensure that the codes match. Tap Pair to continue the pairing process. When the watch is connected to the phone, a confirmation message is displayed. On the phone, a screen is displayed that lists the accounts on the phone. Choose a Google Account to add and sync to your watch. Confirm the screen lock and enter the password to start the copying of the account from the phone to the watch. Follow the instructions in the wizard to finish the pairing process.

Companion app for iPhones

An iOS companion app is available but the phone on which the app is installed must be running iOS 8.2 or higher:

On your iPhone, visit the App Store and download and install the Wear companion app on your iPhone. Follow the instructions on the watch and on the phone to begin the pairing process. For additional information, see the related Help page.

Add a Wear OS module to your project

You can add a module for a Wear OS device to your existing project in Android Studio, enabling you to reuse code from your mobile (phone) app.

Provide a Wear OS module in your existing project

To create a Wear OS module, open your existing Android Studio project and do the following:

Click File > New > New Module. In the New Module window, select Wear OS Module and click Next. Under Configure the new module, enter: Application/Library Name : This string is the title of your app launcher icon for the new module.

: This string is the title of your app launcher icon for the new module. Module Name : This string is the name of the folder for your source code and resource files.

: This string is the name of the folder for your source code and resource files. Package Name : This string is the Java namespace for the code in your module. The string is added as the package attribute in the module's Android manifest file.

: This string is the Java namespace for the code in your module. The string is added as the attribute in the module's Android manifest file. Minimum SDK: Select the lowest version of the platform that the app module supports. For example, select API 26: Android 8.0 (Oreo). This value sets the minSdkVersion attribute in the build.gradle file, which you can edit later. Click Next. Options that include code templates are displayed. Click Blank Wear Activity and click Next. In the Configure Activity window, enter or accept the default values for the Activity Name, Layout Name, and Source Language. Click Finish.

Android Studio creates and syncs the files for the new module. Android Studio also adds any required dependencies for Wear OS to the new module's build file. The new module appears in the Project window on the left side of the screen. If you don't see the new module's folder, ensure the window is displaying the Android view.

In the build.gradle file for the new (Wear OS) module:

In the android section, set the values for compileSdkVersion and targetSdkVersion to 28.

section, set the values for and to 28. Update the dependencies section to include the following: dependencies { implementation 'androidx.wear:wear:1.0.0' implementation 'com.google.android.support:wearable:2.7.0' compileOnly 'com.google.android.wearable:wearable:2.7.0' }

section to include the following: Sync your Android Studio project. To run the code in the new module, see Launch the emulator and run your Wear OS app.

Include libraries

Note: We recommend using Android Studio for Wear OS development, as it provides project setup, library inclusion, and packaging.

When you use Android Studio's Project Wizard, the wizard imports dependencies in the appropriate module's build.gradle file. However, the dependencies are not required for all apps; please review the information below about the dependencies.

To update an existing Wear project to the latest SDK version, use the settings listed in the Start a Wear OS project section.

Notifications

For information about dependencies for notifications, see Create a notification on Wear.

Wear UI Library

The components in the Wear UI Library are recommended because they exemplify best practices for watch apps. Therefore, it is recommended that you add a dependency on the Wear UI Library. For more information, see the following pages:

Wearable Support Library

The Wearable Support Library has UI components for watch apps. Some of its classes are deprecated. For information about the classes that replace the deprecated ones, see Use the Wear UI Library.

Although the UI components can change at any time, a change in a component doesn't cause an app to break (because the components are compiled into your app). To get new features from an updated library, statically link the new library version and update your app accordingly.

Play Services and the Wearable Data Layer APIs

If your app depends on Google Play Services, either to sync and send data (using the Data Layer APIs) or for other reasons, you need the latest version of Google Play Services. If you are not using these APIs, remove the dependency.

Differences between phone and watch apps

The following are some of the differences between phone and watch apps:

Watch apps use watch-specific APIs, where applicable (e.g., for circular layouts, wearable drawers, ambient mode, etc.).

Watch apps contain functionality appropriate to a watch.

Watch apps can access many standard Android APIs, but don't support the following: android.webkit android.print android.app.backup android.appwidget android.hardware.usb You can check if a watch supports a feature by calling hasSystemFeature() before using an API.



Save power on the watch

To conserve power on a watch, enable ambient mode in your app. A watch transitions from interactive mode to ambient mode when the watch is idle on an activity or when a user covers the screen with their palm. Watch apps that can transition into ambient mode are called always-on apps. The following describes the two modes of operation for always-on apps:

Interactive Use full color with fluid animation in this mode. The app is also responsive to input. Ambient Render the screen with black and white graphics and do not present any input cues in this mode. This display mode is only supported on devices running Android 5.1 or higher.

On devices running versions prior to Android 5.1 or for apps that do not support ambient mode, when a user is idle on an activity or when the user covers the screen with their palm on an activity, the Wear home screen is displayed instead of your activity in ambient mode. If you need to show persistent content on versions prior to Android 5.1, create a notification in the context stream instead.