Building for Android Wear: Depth and Flexibility

With so many recent updates and improvements to Android Wear, it’s high time to share an updated overview of the platform. We’re certainly not done—there’s a lot more to come—but this is the picture today as you start or continue developing your groundbreaking Android Wear user experiences.

Guns'n'Glory Heros and Strava
Guns’n’Glory Heros and Strava

The Android Wear platform emphasizes depth and flexibility. Built on Android, it allows developers to use familiar APIs to create useful, performant, and imaginative apps that run directly on the watch. In the spirit of Android, you have the freedom to make substantial changes to the user experience, including the creation of custom watch faces. There are three main categories of experiences you can build: apps, custom watch faces, and notifications.

Apps

Apps that are built for Android Wear run directly on the watch and can do nearly anything a phone can, from tracking your run to giving you a little entertainment while waiting for the bus. Some even work without a connection to the phone, such as fitness and music apps. There are libraries to help you move data between the phone and the wearable, as well as create stunning and adaptable UIs. Here’s a list of some of the great features you have access to:

Feature Documentation
Full screen activities with touch events Creating Custom UIs for Wear Devices
Notifications and custom actions UI Patterns for Android Wear
Custom Watch faces Creating Watch Faces
Layouts for round and square devices Creating Custom UIs for Wear Devices
OpenGL Displaying Graphics with OpenGL ES
Sensors: Accelerometer, Gyroscope, Compass, Barometer, Heart rate sensor SensorManager
Haptics Vibrator
Microphone AudioRecord
Voice actions Adding Voice Capabilities
GPS Detecting Location on Android Wear
Offline storing of data / music Transferring Assets
Media playback controls MediaSession, MediaController
Framework based on Android 5.0 API 21 Android 5.0 APIs
Standalone or synchronized apps Sending and Syncing Data

Watch faces
Selected watch faces

Watch Faces

The ability to create custom watch faces gives you direct access to the most prominent UI element on a user’s most personal device. The API is simple enough to build watch faces quickly and flexible enough to allow personalization. Again, given the depth and flexibility of the Android platform, you can create something for the user that’s both beautiful and packed with unique features.

The development journey starts with the simplicity of bringing your design to the wrist. At the core of the watch face API is the onDraw method that allows you to draw whatever design you can think of to the canvas at a high enough frame rate to deliver fluid animation. This will come through at full fidelity while the watch is in interactive mode.

At other times, when the watch is in ambient mode, you’re able to draw a more discreet version of the watch face. Additional preferences can be set to arrange the system UI elements appropriately for your design. Once those basics are covered, the limits are your imagination! You can go further with additions like the moon phase, current weather, or fitness stats. Watchmakers call these items “complications” – but with Android they’re hardly complicated. Once you have the data, just draw it on the canvas as you did the time.

Android Wear Notifications
Glympse and WhatsApp

Notifications

Of course, Android Wear Notifications are the easiest way to get started in the world of wearables. If you’ve got an Android app with notifications – they already work on a Wear watch. If you’ve already enhanced your notification with actions, this is even better and also automatically already works. You can take things further with Wear-specific functionality like Stacks, Pages, and Voice Replies that make your notifications richer experiences on the wrist.

The user experiences you build for Wear get to take advantage of the power and flexibility of the Android platform. It’s easy to get started and possible to create truly groundbreaking UI for your users. Together, we can create an ecosystem of user experiences as diverse as the watches they run on and the people who wear them.

Android Wear Watches

Check out the developer videos and documentation for more, and share your thoughts on the Android Wear Developers community. We can’t wait to see the innovative user experiences you will build on Android Wear.

Cross-posted to Android Developers Blog



Messaging on Android Wear

Sending messages on Android Wear feels as easy as it was to pass notes back in school. Remember when your friends always felt nearby? That feeling is why I love staying in touch with friends and family using my wearable.

Your messaging app likely already works on Android Wear. With just a few more lines of code you can unlock simple but powerful features that let your users communicate even more effortlessly.

Message notifications for free

If your Android app uses notifications to let the user know about new messages, these will work automatically on their wearable. That is, when you build notifications with the NotificationCompat.Builder class, the system takes care of displaying them properly, whether they appear on a handheld or wearable. Also, an “Open on phone” action will be added so it’s easy for the user to reply via the app on their handheld.

Google+ Hangouts message

Google+ Hangouts message.

Reply like a champ

Messages on Wear get really exciting when you can reply directly from the watch with your voice. In addition to being super convenient, this always gives me a Dick Tracy thrill… but maybe that’s just me. =]

To add this functionality, it’s as simple as adding an action to the notification via WearableExtender that includes a RemoteInput to your notification. After the user replies, you’ll just grab their voice input as a string from the RemoteInput included in the Intent. You can even include text responses the user can easily select from a list by passing an array of them to the setChoices method of the RemoteInput. More details and code can be found here.

WhatsApp message with the reply by voice action

WhatsApp message with the reply by voice action.

See who is texting

Messages are more meaningful when you are connected to the sender. That’s why we recommend you include the photo of the sender as the background of the notification. As soon as the user taps into the message, they also see who it’s from, which will make it matter more (or maybe that other thing, depending on who it is).

You should add a photo with a resolution of at least 400x400, but we recommend 640x400. With the larger size, the background will be given parallax scrolling. If the background is to be included in the apk, place it in the res/drawable-nodpi directory. Then call setBackground() on your WearableExtender and add it to your notification. More details and code can be found here.

Path Talk message with a clear picture of the sender

Path Talk message with a clear picture of the sender.

Custom actions

Basic notifications with reply by voice and a good background image are the most important parts to get done right away. But why stop there? It’s easy to extend the unique parts of your service to the wearable. A simple first step is adding in a custom action the way Omlet does. These are just actions defined with the WearableExtender that raise an intent on the handheld.

Omlet actions

Omlet includes two extra actions with every message: Like and Check-In. Check-In sends along the user’s current location.

Custom Layouts

Custom interaction on the wearable, like the following example from TextMe, is straightforward to implement. They have what appears to be a simple notification with an action that allows the user to select an emoticon. However, to show this emoticon picker, they are actually issuing a notification from the wearable. The round trip looks something like this:

The handheld gets a new message, issues a notification setLocalOnly(True), and sends a message to the wearable using the Data Layer API The wearable receives that message using the WearableListenerService and issues a custom notification with a PendingIntent to launch an activity when the user views the notification That activity has a custom layout defined with the Wearable UI Library Once the user selects an emoticon, the wearable sends a message back to the handheld The handheld receives that message and sends it along to the server Custom layouts are documented in more depth here.

TextMe

TextMe allows users to reply with a quick emoticon.

Next steps

Make your messaging service awesome by providing rich functionality on the user’s wearable. It’s easy to get started and easy to go further. It all starts at developer.android.com/wear.

Cross-posted to Android Developers Blog



Page 61 of 62

subscribe via RSS