Modernization Hub

Modernization and Improvement

Introduction to Wear OS Watch Face Development

The watch face is one of the most
prominent UI components of Wear OS by Google. As a developer, you can create
your own custom watch faces and share your creations
in the Google Play Store. I am Francois, and
I will walk you through the high level
design and development steps of the watch face. To kick off, let’s take a look
at the different components of a watch face. At its most basic, a watch
face is an expression of style and provides a way to tell time. Beyond this, there is also
what we call complications. It’s a traditional
watchmaking term denoting areas of the
watch face that show information other than time. In this example, the watch
face is showing the date. With Wear OS by Google
being a connected platform, watch face developers
can take full advantage of data supplied by
the system itself or other apps
installed on the watch. This enables watch
face developers to display bite-sized
information right from the watch face, such
as the current temperature or other information
that the user chooses. Although supporting
complications is technically optional for watch
face developers, we have seen strong user
demand for this feature, and it is very much recommended. Lastly, Wear OS has two modes
of operations, interactive mode and ambient mode. In interactive mode, the user
will expect the watch face to be in full color and
ready for user interaction. In ambient mode, the watch face
should light up no more than 5% of the screen pixels and should
avoid solid blocks of color to prevent screen burn
in on OLED display. In addition, the
screen is not expected to be updated more
than once a minute. So remember to remove any
indication of seconds while in this mode. Now that you have a design,
it’s time to start coding. The easiest way
to get started is to create a new project
in Android Studio. Select Wear OS as the form
factor, and select Watch Face. After you have completed
the setup wizard, you will have a startup project
with a functioning watch face that you can customize. In the generated
code, I would like to highlight three methods
that developers should pay particular attention to. The first one is
onSurfaceChanged. This method is run once at the
start of watch face creation, and it has access to
the screen dimensions. As a result, this
is the perfect time to resize any bitmap
you might have or adjust the size of
your watch face features. The second method is onDraw. This is where the watch
face rendering code lives, and it runs every
time a frame is drawn. As a result, you should pay
attention to its performance. Avoid expensive operations,
such as loading and resizing resources. Last, but not least,
onAmbientModeChanged. This is called whenever the
watch face enters or exits ambient mode. You can use this method to
change and swap paint objects before rendering the screen. As we mentioned before,
Wear OS complications are a powerful way
to help the user stay connected by providing
bite-sized information on the watch face. We have a suite of APIs
to enable your watch face to connect to
external data sources and help you render them
using complication drawables. To find out more,
follow this code lab. With great power comes
great responsibility. Watch faces are one of the
most prominent UI components of the Wear OS platform. At the same time, this
means your watch face will very likely be run for
most of the device uptime. Any inefficiency or
errors will severely impact battery user experience. Before you publish your
watch face, please use it extensively for a long period
of time to catch any issues. Pay particular attention to when
the watch is an ambient mode, that it is not doing more
processing than it needs to. Any rogue code could
severely impact battery life. Watch faces offer an
opportunity to create something very personal, and there
is something special about seeing your own watch
face for the first time on your Wear device. Why not see it for yourself? This might just be the
wearable platform for you. [MUSIC PLAYING]

Leave a Reply

Your email address will not be published. Required fields are marked *