Android App Development: What You Need to Know about Wearable Apps

By Barry Burd

Android wearable apps are very much like phone apps. But if things are so similar, why not just write “Follow the steps you followed for any other app” and be done with it?

The answer is, some aspects of wearable app development are different from their phone and tablet counterparts. The most obvious difference is screen size. You can’t display very much on a one-inch screen, so you have to design your app accordingly.

A wearable app typically comes in two parts — one part that runs on the wearable device, and another part that runs on the user’s phone. The phone part can make use of the larger screen size, so the phone part can contain menus, setup screens, and other features. (Imagine that! A phone has a larger screen size!)

Another limitation for wearables is the number of classes in the API. The following packages don’t work with wearables:

  • android.webkit

  • android.print

  • android.app.backup

  • android.appwidget

  • android.hardware.usb

Like their phone counterparts, each make and model of wearable supports its own set of features. For example, some models have built-in heart rate monitors; others don’t. You can test for the presence of a heart rate monitor with the following code:

import android.content.pm.PackageManager;
…
PackageManager = context.getPackageManager();
if (packageManager.hasSystemFeature
(PackageManager.FEATURE_SENSOR_HEART_RATE)) {
// Etc.

The PackageManager class has dozens of constants like FEATURE_SENSOR_HEART_RATE for the many features that a device may or may not have.

Another important aspect of wearable development is the device’s timeout behavior. When you wake up a phone, you see a lock screen. And when you unlock the screen, you see whatever activity was running when the phone went to sleep. But wearables are different. When you wake up a wearable, there’s no lock screen. Instead, you see either the watch face (typically, the current time) or a new notification.

One way or another, activities on wearables don’t automatically stick around the way they do on phones and tablets. So if you want something that stays on the screen, you need an always-on app.

For information about always-on apps, visit Android’s Developer site.