Posted by Anna Bernbaum – Product Supervisor, and Garan Jenkin – Developer Relations Engineer
Ultimately yr’s Google I/O, we launched the Watch Face Format for Put on OS. This yr, 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 yr, you’ll additionally see an replace to Watch Face Studio to make the most of them.
The Watch Face Format is the really useful strategy 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 increased. 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’ve got additionally made some adjustments to look at face growth.
New options within the Watch Face Format
Flavors
Flavors characterize preset configurations on your watch face, obtainable within the companion app:
They permit the watch face developer to configure helpful and enticing mixtures of the watch face’s configuration choices, and permit the consumer 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 “purpose progress” and “weighted parts” complication sorts to the Watch Face Format:
- Aim progress is ideal for information the place the consumer has a goal, however that concentrate on will be exceeded. A superb instance is step rely.
- Weighted parts can characterize discrete subsets of information, displaying their relative sizes, the place you would possibly in any other case use one thing like a pie chart.
Each of those complication sorts will be accessed by means of the [COMPLICATION.*] expression object. For full particulars, see the complication steerage.
Climate
Understanding at-a-glance what the climate will probably be like for the subsequent hour, day, and past could make all of the distinction to a consumer’s plans! Unsurprisingly, having climate information 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 give you the option make watch faces like this:
Climate Fundamentals
Climate within the Watch Face Format is accessed through the [WEATHER.*] expression object. You should utilize 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 situations: %s
<Parameter expression="[WEATHER.CONDITION_NAME]"/>
</Template>
The climate supplier within the Watch Face Format helps a spread of various metric sorts for the present day, together with the next:
- Present situations
- Temperature – present, minimal (low), and most (excessive)
- UV index
- Probability of rain
For the total vary of information sorts and situations, see the climate information.
Forecasts
Along with the present climate, you possibly can entry forecast information, 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, corresponding to checking for forecast availability or loading errors. For all of this and extra, check out the climate information.
Modifications to Watch Face growth
As we collect momentum behind the Watch Face Format, we’re asserting some adjustments to present watch face growth choices.
We introduced lately that just some problems will probably be obtainable on Put on OS 5, for watch faces constructed with AndroidX or the Wearable Help Library. This restriction doesn’t apply to look at faces that use the Watch Face Format.
Moreover, beginning in early 2025 (particular date to be introduced in This autumn 2024), all new watch faces revealed on Google Play should use the Watch Face Format. Present watch faces that use different libraries, corresponding to AndroidX or the Wearable Help Library, can proceed to obtain updates with out transitioning to the brand new format.
New sources
To make it simpler to create watch faces utilizing the Watch Face Format, we’ve revealed some extra sources on GitHub.
You now have full entry to the XSD specification, that can assist you construct your personal watch face producing instruments.
We’ve additionally supplied validators to examine your XML for correctness and reminiscence utilization. These are the identical checks run by Google Play, so it permits you to run these checks even earlier than you submit your watch face for publishing.
Be taught extra
Get began with the most recent model of the Watch Face Format.
You’ll want to take a look at Constructing for the way forward for Put on OS technical session and What’s new in Put on OS at I/O 2024 weblog put up 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