Flavor


A Flavor specifies a set of configuration values, grouped as a preset. Typically, the user can choose from these Flavors in the companion app.

A Flavor can include values for existing configurations, including the following types:

  • BooleanConfiguration
  • ColorConfiguration
  • ListConfiguration
  • ComplicationSlot

Since version 2

Syntax

 id="string" displayName="string" icon="string"
    screenReaderText="string">
    
     ... />
     .../>
>

You can include Flavor elements within a UserConfigurations element, as shown in the following example:


  
   id="themeColor" ... />
  

  
   defaultValue="1">
     id="1" displayName="1st flavor" icon="flavor_1_preview">
         id="themeColor" optionId="0"/>
         slotId="0">
                            defaultSystemProvider="DAY_OF_WEEK"
                defaultSystemProviderType="SHORT_TEXT"/>
        
    

     id="2" displayName="2nd flavor" icon="flavor_2_preview">
         id="themeColor" optionId="1"/>
         slotId="0">
                            defaultSystemProvider="WATCH_BATTERY"
                defaultSystemProviderType="SHORT_TEXT"/>
        
    
  

In order to use Flavors, the following must be added to res/xml/watch_face_info.xml:

 version="1.0" encoding="utf-8"?>

    ...
     value="true" />
     value="true" />

Attributes

The Flavor element has the following attributes:

Required attributes

The following attributes are required:

id
A unique identifier for the Flavor.
displayName
A resource ID corresponding to the text that is displayed in the companion.

Optional attributes

The following attributes are optional:

icon
A resource ID corresponding to the drawable resource which is shown in the companion. This should have a maximum size of 360x360 px.
screenReaderText
A resource ID corresponding to the text which is used if the user has TalkBack enabled.

Inner elements

The Flavor element must contain at least one Configuration element and can optionally include ComplicationSlot elements.

  • The Configuration element references previously defined configuration elements, such as BooleanConfiguration, using the id attribute. The Configuration elements sets the chosen value for this configuration option using the optionId attribute.

  • The ComplicationSlot element can be used to specify the DefaultProviderPolicy for a given Flavor.