The Android Wear Developer Preview provides tools and APIs that allow you to enhance your app notifications to provide an optimized user experience on Android Wear.
With the Android Wear Developer Preview, you can:
  • Run the Android Wear platform in the Android emulator.
  • Connect your Android device to the emulator and view notifications from the device as cards on Android Wear.
  • Try new APIs in the preview support library that enhance your app's notifications with features such as voice replies and notification pages.
To get access to the Developer Preview tools, click the sign up button on the right, then follow the setup instructions below.
Sign Up for the Developer Preview
Signing up provides you access to:
  • New notification APIs in the preview support library.
  • Sample apps using the new notification APIs.
  • The Android Wear Preview app for your mobile 
  • device, which connects your device to
  • the Android Wear emulator.
Caution: The current Android Wear Developer Preview is intended for development and testing purposes only, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).

Prerequisites


Before you begin the setup, you must:
  1. Install the Android SDK.
    The Android SDK includes all the developer tools required to build apps for Android (optional IDEs are also available for download).
  2. Sign up for the Android Wear Developer Preview.
    You must sign up with a Gmail or other Google account in order to download the preview support library and receive access to the Android Wear Preview beta app on Google Play Store.
Note: If you're already using the ADT plugin for Eclipse, you must update to version 22.6.1 or higher. To check for updates, select Help > Check for updates in the Eclipse toolbar.

1. Install the Android Wear system image


  1. Launch Android SDK Manager.
    • From Eclipse, select Window > Android SDK Manager.
    • From Android Studio, select Tools > Android > SDK Manager.
  2. Below Tools, verify that you have Android SDK Tools revision 22.6 or higher.
    If your version of Android SDK Tools is lower than 22.6, you must update:
    1. Select Android SDK Tools.
    2. Click Install package.
    3. Accept the license and click Install.
    4. When the installation completes, restart Android SDK Manager.
  3. Below Android 4.4.2, select Android Wear ARM EABI v7a System Image.
  4. Below Extras, ensure that you have the latest version of the Android Support Library. If an update is available, select Android Support Library. If you're using Android Studio, also select Android Support Repository.
  5. Click Install packages.
  6. Accept the license and click Install.

2. Set Up the Android Wear Emulator


  1. Launch the Android Virtual Device Manager.
    • From Eclipse, select Window > Android Virtual Device Manager.
    • From Android Studio, select Tools > Android > AVD Manager.
  2. Click New.
  3. For the AVD Name, enter "AndroidWearSquare" or "AndroidWearRound", depending on whether you want to create an emulator with a square or round display.
  4. For the Device, select Android Wear Square or Android Wear Round.
  5. For the Target, select Android 4.4.2 - API Level 19 (or higher).
  6. For the CPU/ABI, select Android Wear ARM (armeabi-v7a).
  7. For the Skin, select AndroidWearSquare or AndroidWearRound.
  8. Leave all other options set to their defaults and click OK.
    Although real Android Wear devices do not provide a keyboard as an input method, you should keepHardware keyboard present selected so you can provide text input on screens where users will instead provide voice input.
  9. In the list of AVDs, select the one you just created and click Start. In the following window, click Launch.
The Android Wear emulator now starts. To begin testing your app's notifications, you must now pair the emulator to your development device that has the Android Wear Preview app installed.
Tip: To improve the emulator startup time, edit your AVD and enable Snapshot under Emulator Options. When you start the emulator, select Save to snapshot then click Launch. Once the emulator is running, close it to save a snapshot of the system. Start the AVD again, but select Launch from snapshot and deselect Save to snapshot.
Caution: Do not install apps on the Android Wear emulator. The system does not support traditional Android apps and the result of running such apps is unpredictable.

3. Set Up the Android Wear Preview App


The Android Wear Preview app is an app you must have installed on your Android device (a phone or tablet) in order to deliver app notifications to the Android Wear emulator.
To receive the Android Wear Preview app, you must sign up for the Developer Preview using the same Gmail or Google account you use with Google Play Store.
Note: The Android Wear Preview app is compatible with Android 4.3 and higher and is not available for the Android emulator.
After you've signed up for the Developer Preview, you'll receive a confirmation email that includes a link to opt-in to the Android Wear Preview app beta program. Once you opt-in, it may take up to 24 hours for the app to become available in Google Play Store.
After you install the Android Wear Preview app, you can set up your device to communicate with the Android Wear emulator:
  1. Open the Android Wear Preview app. You should see a notice that the app is currently not enabled as a notification listener. Tap the message to open the system settings, then select Android Wear Preview to grant it notification access.
  2. Connect your device to your development machine over USB. Be sure that no other Android devices are connected to the machine.
  3. Ensure that the Android Wear emulator (created in the previous section) is running. The emulator should show the time and an icon that indicates no device is connected.
  4. Open a command line terminal, navigate to your Android SDK's platform-tools/ directory, then execute:
    adb -d forward tcp:5601 tcp:5601
  5. Return to the Android Wear Preview app. It should now indicate that it is connected to the emulator. The Android Wear emulator should now show the 'g' orb icon, indicating that is is connected to your device.
Now, notifications from your device also appear in the Android Wear emulator.

4. Add the Support Library to Your Project


The Android Wear preview support library includes several APIs that allow you to optimize your app's notifications for the Android Wear user experience.
To receive the preview support library, you must sign up for the Developer Preview. The confirmation email you receive after you sign up includes a link to download a ZIP file, which contains the preview support library and some sample apps.
After you download and unzip the package, add the preview support library sto your Android project:
If you're using Eclipse:
  1. In your Android app project, create a libs/ directory in your project root (the same location as theAndroidManifest.xml file).
  2. Copy the v4 support library JAR file from your Android SDK directory (e.g.,<sdk>/extras/android/support/v4/android-support-v4.jar) into your project libs/ directory.
  3. Also save the wearable-preview-support.jar file in the libs/ directory.
  4. Right click each JAR file and select Build Path > Add to Build Path.
If you're using Android Studio:
  1. In your Android app project, create a libs/ directory in your project root (the same location as theAndroidManifest.xml file).
  2. Save the wearable-preview-support.jar file in the libs/ directory.
  3. Open the build.gradle file in your app module.
  4. Add a dependency rule for both the v4 support library and the Android Wear preview support library:
    dependencies {
        compile "com.android.support:support-v4:18.0.+"
        compile files('../libs/wearable-preview-support.jar')
    }
  5. Click Sync Project with Gradle Files in the toolbar.
To start optimizing your notifications for Android Wear, read Creating Notifications for Android Wear.
 
Top