Posted by Anna Bernbaum – Product Supervisor, and Garan Jenkin – Developer Relations Engineer
Eventually 12 months’s Google I/O, we launched the Watch Face Format for Put on OS. This 12 months, as a part of our continued partnership with Samsung, we’re excited to share some new options that you should utilize to create thrilling new watch face designs! These options are actually supported in XML definitions, and later within the 12 months, you’ll additionally see an replace to Watch Face Studio to benefit from them.
The Watch Face Format is the beneficial method to create watch faces for Put on OS. The format makes it simpler to create customizable and extra power-efficient watch faces for units that run Put on OS 4 or larger. The Watch Face Format is a declarative XML format, so there isn’t any executable code concerned in making a watch face, and there’s no code embedded in your watch face APK.
Moreover, in our transfer towards the Watch Face Format for watch face creation, we have now additionally made some modifications to observe face improvement.
New options within the Watch Face Format
Flavors
Flavors signify preset configurations on your watch face, obtainable within the companion app:
They permit the watch face developer to configure helpful and engaging mixtures of the watch face’s configuration choices, and permit the person to visualise and choose from these with ease.
We’ve now introduced flavors to the Watch Face Format. For a full information on including them to your watch face, see the flavors reference.
Issues
We’re including help for each “objective progress” and “weighted parts” complication varieties to the Watch Face Format:
- Aim progress is ideal for knowledge the place the person has a goal, however that concentrate on will be exceeded. instance is step depend.
- Weighted parts can signify discrete subsets of information, exhibiting their relative sizes, the place you would possibly in any other case use one thing like a pie chart.
Each of those complication varieties will be accessed by the [COMPLICATION.*] expression object. For full particulars, see the complication steerage.
Climate
Figuring out at-a-glance what the climate might be like for the subsequent hour, day, and past could make all of the distinction to a person’s plans! Unsurprisingly, having climate knowledge as a knowledge supply within the Watch Face Format has been a standard request, and we’re delighted to have the ability to introduce it on this newest model. You’ll now have the ability make watch faces like this:
Climate Fundamentals
Climate within the Watch Face Format is accessed by way of the [WEATHER.*] expression object. You should use it in Situation and textual content Template statements and anyplace the place expressions are supported.
For instance, to point out the present climate situation, use this template and expression:
<Template>Present climate circumstances: %s
<Parameter expression="[WEATHER.CONDITION_NAME]"/>
</Template>
The climate supplier within the Watch Face Format helps a variety of various metric varieties for the present day, together with the next:
- Present circumstances
- Temperature – present, minimal (low), and most (excessive)
- UV index
- Probability of rain
For the total vary of information varieties and circumstances, see the climate information.
Forecasts
Along with the present climate, you may entry forecast knowledge, each by hour and by day. For instance, to entry the forecast most temperature for tomorrow, use a template and set of expressions much like the next:
<Template>Tomorrow max temp: %d°%s
<Parameter expression="[WEATHER.DAYS.1.TEMPERATURE_HIGH]" />
<Parameter expression="[WEATHER.TEMPERATURE_UNIT] == 1 ? "C" : "F"" />
</Template>
When utilizing climate within the Watch Face Format, there are some additional particulars to concentrate on, reminiscent of checking for forecast availability or loading errors. For all of this and extra, check out the climate information.
Modifications to Watch Face improvement
As we collect momentum behind the Watch Face Format, we’re saying some modifications to current watch face improvement choices.
We introduced not too long ago that just some problems might be obtainable on Put on OS 5, for watch faces constructed with AndroidX or the Wearable Help Library. This restriction doesn’t apply to observe faces that use the Watch Face Format.
Moreover, beginning in early 2025 (particular date to be introduced in This fall 2024), all new watch faces printed on Google Play should use the Watch Face Format. Present watch faces that use different libraries, reminiscent of AndroidX or the Wearable Help Library, can proceed to obtain updates with out transitioning to the brand new format.
New assets
To make it simpler to create watch faces utilizing the Watch Face Format, we’ve printed some extra assets on GitHub.
You now have full entry to the XSD specification, that will help you construct your personal watch face producing instruments.
We’ve additionally offered validators to test your XML for correctness and reminiscence utilization. These are the identical checks run by Google Play, so it lets you run these checks even earlier than you submit your watch face for publishing.
Study extra
Get began with the most recent model of the Watch Face Format.
Make sure to try Constructing for the way forward for Put on OS technical session and What’s new in Put on OS at I/O 2024 weblog submit to be taught extra about all the most recent updates for Put on OS!
Code snippets license:
Copyright 2023 Google LLC.
SPDX-License-Identifier: Apache-2.0