Sunday, 30 March 2014

Android Wear 101

This post is about getting started with Android Wear. 

At the time of this post, the Android Wear SDK is still in preview. 

This is much more promising and happening than other Android related attempts by Google (ADK/accessories, home automation, Nexus Q). And finally this might give some life to Google Glass as a consumer device, which will turn out to be just another wearable. 

While the initial preview is limited to notifications, even near-future versions appear pretty good.

Before the first steps, the URLs to bookmark:
The official resource site:
This blog
Join this official community on Google Plus

Now the steps:

Step 0: Android SDK

If you don't already have Android SDK (ADT bundle or Android Studio) install it first. And then download the latest API through it.

Step 1: Signing-up

Click this link to signup:

Step 2: Opting-in and Downloading 

In response, you'll get a mail from google with a private Google Drive attachment and few URLs. The content goes something like this:

Hello Developer,
Thank you for signing up for the Android Wear Developer Preview.
To begin developing on Android Wear, you’ll need the Preview Support library and the Android Wear Preview app for your mobile device. Follow these steps:

  • Download (<-- private link) the Preview Support library and samples.
  • Opt-in to become a tester of the Android Wear Preview app in the Google Play Store. After opt-in, it could take up to 24 hours for the Android Wear Preview app to be accessible to you in Google Play. Make sure the opt-in user account is the same user signed in to Google Play.
Refer to the Android Wear Developer Get Started page for details. Since this is a preview release, please do not publicly distribute apps built with the Preview library. Also note that the APIs are potentially subject to change and you will need to modify your apps when they are released out of preview.
Share your experiences and ask questions by joining the Android Wear Developers Google+ Community. We look forward to seeing how your apps take advantage of these new APIs to provide innovative new user experiences!
— The Android Wear Team
© 2014 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA
Download the attachment ( and unzip it somewhere near your Android SDK. Apart from the usual (license and dummy readme files), it has the wearable-preview-support.jar and few samples:

  • ElizaChat
  • RecipeAssistant
  • WearableNotificationsSample
  • prebuilt-libs/wearable-preview-support.jar (again within samples folder)

Before we start working, finish the housekeeping task of opting in as tester. Once done it may take few minutes before it lets you download "Android Wear Preview" application from a private link. 

Here's how your page at 
should look once you've been accepted as a tester:

It has links to the app. Download and install that to your Android phone/tablet running latest (4.3 Jellybean) firmware.

Step 3: Updating Android SDK

Launch Android SDK Manager: 

From Eclipse > Window > Android SDK Manager.
Or from Android Studio > Tools > Android > SDK Manager.
Or from command line > android
('android' is the utility within android sdk/tools folder)

In tools subsection, 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:
Select Android SDK Tools > Install package > Accept the license > Install.
When the installation completes, restart Android SDK Manager.
Tip: Few have had issues updating another tools version within Eclipse. Changing Android Developer Tools Update Site' URL from to helps resolve this issue. This is changed in Eclipse > Help > Install New Software > Available Software Sites > [Choose and edit to https from http based URL].
Similarly, in Android 4.4.2 or the latest API subsection, select Android Wear ARM EABI v7a System Image.
And in Extras subsection, ensure that you have the latest version of the Android Support Library. 
Android Studio users must also update Android Support Repository to the latest. 

Step 4: Emulating Android Wear

Launch the Android Virtual Device Manager.

From Eclipse > Window > Android Virtual Device Manager.
Or from Android Studio> Tools > Android > AVD Manager.
Or from command line > android avd
('android' is the utility within android sdk/tools folder; avd is the argument to start android virtual device manager)

Create a new AVD

For the AVD Name, be creative or just pedantic and call it "awr_19" for round or "aws_19" for square depending on whether you want to create an emulator with a square or round display for target API level 19.

For the Device, select Android Wear Round or Android Wear Square
For the Target, select Android 4.4.2 - API Level 19 (or latest).
For the CPU/ABI, select Android Wear ARM (armeabi-v7a).
For the Skin, select AndroidWearRound or AndroidWearSquare.

Leave all other options set to their defaults and click OK.
Although real Android wearables do not provide a keyboard as an input method, you should keep Hardware keyboard present selected so you can provide text input on screens where users would actually provide voice input. For this purpose 

Launch the AVD

In the list of AVDs, select the one you just created and click Start. In the following window, click Launch.
Tip: After the AVD is created, if Launch fails, try to do the same from command line instead using 
  emulator64-arm -avd "awr_19" -no-snapshot-load
or (from a 32bit OS machine)
  emulator-arm -avd "awr_19" -no-snapshot-load
(replace awr_19 with the name you just game)

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.

Wait for a minute or two. Woohoo. It might appear darker. Click on it to wake your Android Wear Emulator up. 

Android Wear Round Emulator (Default home+lock screen in Preview SDK - before connection)

If you see this emulator screen you are ready to proceed. However it is in disconnected state as indicated by a device icon with a slash. This wearable's emulator instance needs to connect with a phone/tablet running Android Wear Preview application over USB now. 

Step 5: Android Wear Preview Application

Using an USB cable from your computer, connect the device on which you installed Android Wear Preview app (see step 2).

Launch the android wear preview application . 

Clicking on the blue banner on the initial screen, takes you to Settings > Security > Notification Access

Here it is listed as a potential application to access notifications but isn't enabled.

Enable it, read and accept the pop-up dialog. 

Now go back to the application. which is still trying to connect with our emulator instance. 

To link the two, from command line use: 
adb -d forward tcp:5601 tcp:5601
Note: For this USB debugging must be enabled on your device. Which is done from Settings > Developer options. If developer options is not listed in settings, tap Settings > Build Version for half a dozen times! Not joking. 

Hope this turns the status from connecting to connected. 

And another important thing to observe is the icon on the emulator has gone from a device with a slash to "g".

Almost all notifications that show up on the phone will now be mirrored to the wearable device's emulator instance. Google plus, gmail, etc already show the notification summary. These are chosen by sliding up on the wearable. Further on sliding to the right on the wearable, actions could be performed. At present the actions are typically limited to opening the respective application. 

No comments:

Post a Comment

PG content please :)