Hands On with the Android Wear Developer SDK

Share this article

Google recently announced the Android Wear Developer Preview. It is designed for creating wearable experiences for existing Android apps that may appear on forthcoming square and round Android wearables, like watches.

You can customize and extend notifications using Android Wear APIs. It creates a standard user experience for wearable devices connected to Android powered smartphones.

Google states that Android wear is the following:

Small, powerful devices, worn on the body. Useful information when you need it most. Intelligent answers to spoken questions. Tools to help reach fitness goals. Your key to a multiscreen world.

Google has provided a SDK update, an emulator and several other tools for Android Wear. At the moment you will need to register for the Android Wear Developer Preview:

A good starting point to understand how wearables could work is this YouTube Video produced by Google.

Android Wear System Image Installation

If you don’t have it already, start by downloading the Android SDK. After download, unzip the folder. It consists of the folder structure below:

  • Eclipse IDE (folder)
  • SDK (folder)
  • SDK Manager (application)

Figure1

  • Launch SDK Manager:
    Note: If your version of Android SDK Tools is lower than 22.6, it will need to be updated.
  • Go to Packages and select Android SDK tools.

Figure 2: Selecting Android SDK Tools from Tools Package

  • Below Android 4.4.2 (API 19), select Android Wear ARM EABI v7a System Image to install Android Wear:

Select Android Wear ARM EABI v7a System Image under Android 4.4.2 Package

  • Below Extras, ensure you have the latest version of the Android Support Library. Update it if newer versions are available.
    Also select Android Support Repository, if you’re using Android Studio.
  • As shown below, click Install packages, Accept the license and click Install.

Accept Terms and Conditions and click Install
Packages Installing

  • After installation, check that the version is higher than 22.6:

Checking the version after Installing Packages, it is now 22.6

  • Restart Android SDK Manager when installation completes.

Android Wear Emulator Set Up

To set up an Android Wear Emulator, create a new Android Virtual Device (AVD) for Wear using the system image just downloaded. There are two skins available, Round and Square. I have used round here.

  • Launch the Android Virtual Device Manager. From Eclipse, select Window > Android Virtual Device Manager.

Open Android Virtual Device Manager from Eclipse - Window menu

  • Click New to create new Android Virtual Device:

After opening AVD Manager, click on New for adding new Android Virtual Device

*Enter the following details:

AVD Name: This is the Android Virtual Device name, I have used “Amit_AndroidWearRound”
Device: Select from Round or Square, I have selected Android Wear Round (320 x 320: hdpi) to simulate a ‘watch’.
Target: Select Android 4.4.2 – API Level 19 (or higher)
CPU/ABI: Android Wear ARM (armeabi-v7a).
Keyboard: Keep Hardware keyboard present selected so you can provide text input instead of voice input.
Skin: Select AndroidWearSquare or AndroidWearRound. I have selected AndroidWearRound

Leave the rest as default and click OK

Creating new Android Virtual Device (AVD)

  • Now, the list of existing AVDs can be seen, which shows AVD Amit_AndroidWearRound:

Amit_AndroidWearRound AVD created successfully

  • Select and click Start. The window “Launch Options” will appear, click Launch.

Start the newly created Android Virtual Device Amit_AndroidWearRound

  • Now, after clicking Launch wait for the Android Emulator to load.

Starting Emulator

  • The Android Wear emulator will now start. It will look like the one pictured below.

First look of Emulator in round shape

  • The time and disconnected phone icon seen here in the Emulator are nothing to worry about. It shows that emulator is not connected to a phone. This is an indication that you’re following the steps correctly.

Date and disconnected phone icon shows it is successfully implemented

Android Wear Preview App Set Up

To view your app’s notifications on the Android Wear emulator, follow the steps below to download the Android Wear Preview App and support libraries:

Sign up for the Developer Preview using a Google account.

Note: Use the same Google Account to receive the Android Wear Preview app from the Play Store

Signing Up for Android Developer Preview App
Important Message after submitting the form

  • Check your email, you’ll receive a confirmation email like the one shown below. This email will include:
    • 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 the Play Store.
    • Download link for Preview Support Library and samples

Email sent by Google in reply to your email

  • Select “Opt-in to become a tester” from above, you will be redirected to Google Play Store. Now, click “Become a Tester”:
  • You’re now successfully registered as a Tester.

Registered as a TESTER

  • It may take up to 24 hours for the app to become available in the Play Store. Login from the same account used above and download Android Wear Preview app as shown.

Download Android Wear Preview App from Google Play Store, screenshots shown here are for connection, disconnection, settings and notification

Note: Your device will need to be running Android 4.3 and above

After installing the Android Wear Preview app, set up your device to communicate with the Android Wear emulator:

  • Open the Android Wear Preview app, it will currently say “The app is currently not enabled as a notification listener”. Tap the message to open the system settings. To grant it notification access, select Android Wear Preview.
  • Use USB to connect your device to your development machine.
    Note: No other Android devices should be connected to the machine.
  • Ensure that the Android Wear Emulator is running, i.e. the one we created earlier. The emulator should be in the same state, showing the time and disconnected icon that indicates no device is connected.
  • Open a command line terminal, navigate to your Android SDK’s platform-tools/ directory and execute the following command (Remember that this command is to be executed each time you connect your device over USB).

adb -d forward tcp:5601 tcp:5601

  • Next, return to the Android Wear Preview app. The Android Wear emulator will now show the ‘g’ orb icon, indicating that it is paired to your Android Device.

Now, notifications from your device also appear in the Android Wear emulator.

Note: You may get “error: device not found” error. This means that the Android device is not properly setup with the computer for debug. You may have to enable the USB debugging mode in developer options, install the right USB device driver:
Settings -> Developer Options -> Enable USB Debugging

Enabling USB Debugging in your Android Phone

Some interesting Android Wear Notifications

After this setup you should be able to see Notifications on the Emulator. As a simple example, try calling your phone and observe what happens in the wearable emulator.

Some notification examples are listed below which have been taken from the official Android Wear Developer Website:

Context Stream:

  • Shows vertical list of cards.
  • Each card shows potentially useful information.
  • One card is displayed on the screen at a time.
  • Additional visual information can be provided by background images.
  • If a card is not in use, it can be removed by swapping from left-to-right.

Different card layout

The Cue Card

  • The cue card is opened by voice input such as, “Ok Google”.
  • It can also be started by tapping on the “g” icon on the home screen.
  • It allows users to speak to their device.
  • Swiping up on the cue card shows a list of actions.

Cue card which allows users to speak to their device

Notifications

  • Notifications are a core component of Android Wear.
  • They should reflect the urgency of a notification with priority.
  • Time-sensitive notifications carry high priority.

Notifications

Actions

  • Appear to the right of your notification.
  • A maximum of three actions are allowed.
  • These are optional.
  • An action consists of an icon and a caption.
  • Captions should be kept short.

Actions

Pages

  • Use pages to provide additional content and information instead of packing information in primary notification.
  • Pages appear immediately to the right of the main notification card.
  • It could be a next train departure card, a card showing the weather forecast, scheduled matches etc.

Different pages layout

Voice Replies

  • Provides a hands-free method of dictating a short message.
  • Used by messaging applications and suggested to be used to cover a range of simple, neutral replies in the choices you provide.
  • Five suggested replies can be provided.

Voice Inputs

Future Plans

Google is planning to launch new APIs for Android wear which will help developers create more customized apps. It may consist of these features:

Building Custom UI

Creating custom card layouts and running activities on wearable’s directly.

Sending Data

Enabling sending data and actions between the wearable and phones with data replication APIs and Remote Procedure Call (RPC).

Control Sensors

The ability to gather sensor data and displaying it in real-time on Android wearables.

Upcoming development also includes:

  • Launching Android Wear SDK.
  • Android’s partnership with different vendors to launch devices powered by wearable.

Different vendors to launch watched powered by wearable

Further examples provided by Android wearable will be discussed in my next Article which will include creating notifications, receiving voice replies and more. Until then just give it a try by signing up for the Developer preview and following the above given steps.

Amit DiwanAmit Diwan
View Author

Amit Diwan is a founder at Studyopedia, who has taught more than a million engineers and professionals on the following technologies: Python, Java, Android, WordPress, Drupal, Magento, JavaScript, jQuery, HTML5, Bootstrap 4, etc.

androidandroid wearEmerging TechGoogle Tutorials & Articleswearables
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week