On a recently held I/O 2015 event, Google has unveiled some upcoming features for Android Wear, which is considered one of the most promising tech areas of mobile development. We asked Vitaliy Levytskyy, an N-iX Android Developer to provide more information about the booming technology and explain how wearables are influencing Android Development trends.Intro
Android Wear is a most recent branch of Google development strategy that was officially announced in March 2014. It offers wearables an opportunity to operate on a specific version of Android designed exclusively for this kind of devices. A few months later after the Google I/O event, first two devices operating on Android Wear (Samsung Gear Live and LG G Watch) were introduced. After almost a year since launch, the technology is supported by major wearables manufacturers and there are 4,000 Android Wear apps out there on the Play Store. So this is perfect time to start getting to grips with this exciting new platform.
The Android Wear operating system uses Bluetooth to connect to handheld device(s) running Android 4.3 or higher. Once this connection is made, the wearable channels information and updates from the paired smartphone and/or tablet, and conveniently displays them on the user’s wrist. These updates include things like Google Now cards, Gmail, Google Calendar, and phone notifications, such as incoming calls and text messages.
But, Android Wear is more than just a convenient tool to receive smartphone and tablet notifications. Android Wear can also execute tasks on the paired smartphone or tablet. For example, you can use your Android Wear device to play, pause, and skip music tracks on your handheld.
Another big part of the Android Wear experience are vocal commands. Vocal commands allow you to retrieve information as well as execute tasks on the wearable and on the paired handheld device(s). When the user wants to issue a vocal command, all they need to say is “Okay, Google”, followed by their command.
Rather than quitting and launching apps as you would do on a smartphone or tablet, the majority of wearable apps work around a card-based system.
The heart of the Android Wear user interface is a vertical stream of cards that appear automatically based on factors such as location, time, and the user’s activity and interests. If you’re familiar with Google Now, the Context Stream will feel instantly familiar as it resembles an automatically-ranked stream of Google Now cards.
But unlike the Google Now cards you’re used to seeing on your smartphone or tablet, Android Wear only displays a single card at a time. With this in mind, your app should require user input only when it’s absolutely necessary. On the rare occasions where you do need some input from the user, you should focus on quick and easy interactions such as taps, swipes, and voice commands, as anything more complicated is difficult for the user to achieve on a wearable’s smaller screen.
Sometimes, the user won’t get the information he needs from the single notification card or he wants to perform a specific task. In these situations, the user can tell Android Wear what he wants to do by issuing a vocal command.
When the user pronounces the “Okay, Google” wake-up command, what he is actually doing is launching a special “Cue Card” that proceeds data acquired from the vocal command.
Android Wear Libraries and Classes
The Android Wear APIs are delivered via Google Play services and the Android Support Library. This is a broad topic that’s worth deeper exploring, but there’s a couple of libraries and classes that are worth to be introduced at the very beginning.
Android Support Library & NotificationCompat
The easiest way to start developing for wearables is to create a handheld app that can send notifications to a paired wearable device.
Extending your notifications in this way requires several classes, which you can find in the Android v4 Support Library
- WearableExtender: This class allows you to add wearable-specific extensions to your notifications, which is essential for providing users with the best possible Android Wear experience.
- Builder: This builder class ensures your notifications display properly, both on handheld and wearable devices.
- NotificationManagerCompat: This class ensures your notifications properly support wearable features. When it’s time to deliver your notifications, make sure you useNotificationManagerCompat instead of If you do use NotificationManager, it’s possible some NotificationCompat. WearableExtender features won’t function properly.
- Action.WearableExtender: This class extends notification actions to wearables. Each action must have a title, an icon that represents the action, and an Intent that’s sent whenever the user invokes the action.
Creating a Wearable App
The key to developing a great Android Wear app is to keep questioning how you would use a traditional watch. Do you stare at your watch’s face for any significant length of time? Or do you just glance at it and expect to get all the information you need?
The user will expect to interact with their smartwatch and by extension your app—in exactly the same way as their normal watch. Therefore, a big part of designing a successful wearable app is to make it as glanceable as possible. To design a glanceable app and notification cards, keep the following guidelines in mind.
- Display One Piece of Information at a Time
- Keep Text to a Minimum
- Increase Font Size
- Make Use of Background Images
Wearable applications can use a lot from default android SDK library, but there are several limitations, appeared due to Android Wear features (like using default voice input instead of any IME).
In order to start developing for Android Wear, you have to get next components:
- SDK Tools
- Platform tools
- Build tools
Also, it requires the following libraries:
- Android Support Library
Then you should install the official AndroidWear, application.
When you connect a wearable AVD to a handheld device, the AVD automatically starts pulling notifications from the connected smartphone or tablet, and displays them as cards in its emulated Context Stream. A good way to familiarize yourself with Android Wear is to spend some time swiping through these personalized notification cards.
On your handheld device, open the Google Play store and install the official Android Wear app.
Android smartphones or tablets pulling notifications from it and displaying them as card in the Context Stream. But if tour application doesn’t explicitly support Android Wear, you can’t be sure, that it will display notifications correctly on Android Wear device. The right solution for providing best experience for Android Wear users is to create handheld notifications that can easily extend to a paired wearable device.
For creating this kind of application you should crate appropriate project in Android Studio. Also you should set Support Library in build.gradle file.
In layout file there is a button that triggers the notification.
Now you should create file with sources. At first you should import default packages.
And there is a specific import for wearables, from Support Library that allows you to create a specific notification.
And here is implementation of StartActivity class with creating notification and sending it.
After that you could test application on handheld and wearable platforms.Full-screen apps Although Google is encouraging developers to integrate their apps with Android Wear’s Context Stream, it is possible to create full-screen apps for Android Wear devices.
Wearable full-screen apps actually consist of a handheld and a wearable component. The user installs the handheld app on their smartphone or tablet, and the system automatically pushes the wearable component to the paired Android Wear device. If you want to create a full-screen wearable app, you need to create a handheld app that contains a wearable component. You also always free to experiment and implement almost all you can imagine. That’s how ThickButtons keyboard looks on Android Wear emulator:
Android Wear becomes more and more popular because of its incredible features and possibilities, and since this is a pretty new stuff, there is a lot of things that programmers can implement and create. Available Google developer tools provide engineers enough means for making it real. So make sure your app supports this innovative technology, as it is a smart investment in the future.