wear-oswatch-face-api

Using Watch Face Format, how can I add a customizable complication to my watch face?


I am trying to add a complication to my watch face using Watch Face Format. I am following the guide at https://developer.android.com/training/wearables/wff/complication/complication, however the complication does not show up on the watch face (only tappable area is shown if I tap on the area where the complication should be), plus the complication associated setting is missing from the configuration screen.

Are there any working examples of the customizable complications for Watch Face Format?

Here is the relevant part of my watch face XML:

<ComplicationSlot x="100" y="100" width="100" height="100" slotId="10" supportedTypes="SHORT_TEXT" isCustomizable="TRUE">
    <BoundingOval x="0" y="0" width="100" height="100" />
    <DefaultProviderPolicy defaultSystemProvider="WATCH_BATTERY" defaultSystemProviderType="SHORT_TEXT" />
    <Complication type="SHORT_TEXT">
        <PartImage x="35" y="16" width="22" height="22" pivotX="0.5" pivotY="0.5" alpha="255">
            <Image resource="[COMPLICATION.MONOCHROMATIC_IMAGE]" />
        </PartImage>
        <PartText x="18" y="39" width="56" height="22" pivotX="0.5" pivotY="0.5" alpha="255">
            <Text align="CENTER" ellipsis="TRUE">
                <Font family="SYNC_TO_DEVICE" size="20" weight="NORMAL" slant="NORMAL" color="#ffffffff">
                    <Template>
                        %s
                        <Parameter expression="[COMPLICATION.TEXT]" />
                    </Template>
                </Font>
            </Text>
        </PartText>
        <PartText x="19" y="62" width="54" height="14" pivotX="0.5" pivotY="0.5" alpha="255">
            <Text align="CENTER" ellipsis="TRUE">
                <Font family="SYNC_TO_DEVICE" size="12" weight="NORMAL" slant="NORMAL" color="#ffadadad">
                    <Template>
                        %s
                        <Parameter expression="[COMPLICATION.TITLE]" />
                    </Template>
                </Font>
            </Text>
        </PartText>
    </Complication>
</ComplicationSlot>

Solution

  • In case anyone else will have a similar problem -- I managed to figure it out.

    You have to put the <ComplicationSlot> element as a direct child of the <Scene> object. I had it under the <AnalogClock> which can only have hands. It'd be great if Android Studio warned about things like this during compile time.