HOI LAM: Wear OS by Google supports
many cross-platform development options
by default, such as phone notifications
and Actions on Google.
But what if you want to do more and tailor
your experience for the rest?
I'm Hoi Lam, and I will walk you through the development options
for Wear OS, a wearable operating
system by Google for everyone.
Before we begin, it's important to note that Wear OS by Google
is based on Android.
So many of the things that you know about Android development,
such as the concept of activity or services,
the use of Android Studio, or the distribution for the Google
Play Store should be familiar to you.
There are three options if you want
to tailor your app for Wear OS.
Wear apps, watch faces, and complication data provider.
It is not an either/or choice.
You can package one or more of these within the same APK.
So let's briefly go through them in turn.
A Wear app is a good development option
if the user's journey can function better on the wrist
rather than on their phone.
Great examples of this includes exercising, contactless
payment, and messaging.
Creating a Wear app is just like creating a mobile Android
app, with a few enhancements for the wearable form factor.
This includes round screen support for our resource
qualifiers, or [? round ?] [? aware ?] classes,
such as boxings and layout.
In addition, for longer user interactions,
such as shopping lists, exercising, or travel apps,
Wear OS supports ambient mode, which reduces
battery use and screen burn-in.
Another way to develop for Wear OS is to create watch faces.
If you are interested in creating
beautiful and functional timepieces, this is for you.
Showing the time is one of the core aspects of a watch.
And as a developer, you can bring your unique style right
to the watch face.
By overriding the onDraw method in the canvas watch face
service, you can draw lines, shapes, or render bitmaps
through the canvas objects provided.
If you have created a custom Android view before,
this should be familiar to you.
What if your user wanted more than just the time?
For example, what if they wanted the latest news, the battery
level or even the weather?
Being a connected device, and with the user's permission,
Wear OS can supply data from Google
or other third-party apps to your watch face.
These extra pieces of information
are known as complications, a traditional watchmaking
term describing areas of the watch face
that are showing information other than the time.
Watch face developers can take advantage of the complication's
framework to make their watch faces not just beautiful
but highly functional as well.
Lastly, developers can choose to implement a complication data
provider, which allows the app to share data
with the watch face.
This is especially suitable for apps
that have key information the user would like
to see on the watch face, such as share prices or weather
information.
This is a great way to dip your toe into Wear OS development
if you already have a mobile app.
Development of a complication data provider is simple.
Just think about one key piece of information
you would want to show.
To get started, create a complication provider service,
and supply the data requested on demand.
You can also ask the system to request
an update when new information becomes available,
such as a new chat message, or a piece of breaking news.
To conserve battery, Wear OS may reduce the update frequency.
A good rule of thumb is to think of the complication update
intervals being on the order of minutes rather than seconds.
As I said at the beginning, there
are a number of development options available on Wear OS.
From cross-platform support for notifications and Actions
on Google, to Wear applications, watch faces,
and complication data provider.
The choice is yours,
If you're looking to enhance your existing mobile app,
create a complication data provider is probably
the simplest way to get started.
Just follow this code lab.
For more information, check out the Wear OS developer sites.
Happy coding.
[MUSIC PLAYING]