Pular para o conteúdo

Mais visitados

Visitados recentemente

navigation

Watch Face Complications

A complication is any feature in a watch face that is displayed in addition to time. For example, a battery indicator is a complication. The Complications API is for both watch faces and data provider apps.

The rest of this document describes data providers, watch faces, and complication types.

Complication Data Providers

Apps that provide data (such as battery level, weather, or step-count data) to watch faces for complications are called "complication data providers". These data providers supply raw data and are not responsible for controlling how their data is rendered on a watch face. For writing apps that provide data to watch faces, see Exposing Data to Complications.

As shown in the diagram below, Wear OS by Google mediates the flow of data from providers to watch faces.

Complications data flow

Complications in Watch Faces

Watch faces receive data from complication data providers, which allows them to include complications without needing code for getting the underlying data. Watch faces retain control over how the data is rendered, so they can integrate data naturally with their design; see the design patterns for complications.

To learn how to add complications to a watch face, see Adding Complications to a Watch Face.

Complication Types

Complication types define what kinds of data can be shown in a complication or supplied by a data provider. For example, the SHORT_TEXT type is used when the data consists primarily of a short string. A ComplicationData object will always have a single complication type that defines required and optional fields. Generally, a required field represents the primary piece of data; most types take their name from the required field.

Data providers use these complication types differently from the watch faces:

To learn more about different complication types and fields supported by each type, see Using and Testing Complication Types.

API Summary

Below is a summary of the Complications API. The API is part of the Wearable Support Library; see the Wear API Reference.

Additionally, the WatchFaceService.Engine class contains the following methods:

Este site usa cookies para armazenar suas preferências quanto às opções de idioma e exibição específicas ao site.

Receba as dicas e notícias mais recentes para desenvolvedores Android que ajudarão você a ter sucesso no Google Play.

* Campos obrigatórios

Uhu!

Siga o Google Developers no WeChat

Navegar neste site em ?

Você solicitou uma página em , mas sua preferência de idioma para este site está definida como .

Quer alterar sua preferência de idioma e navegar neste site em ? Para alterar a preferência de idioma depois, use o menu de idiomas na parte inferior de cada página.

É preciso ter o nível de API ou superior para esta aula

Este documento está oculto porque o nível de API selecionado para a documentação é o . Para alterar o nível, clique no seletor acima da barra de navegação esquerda.

Para mais informações sobre como especificar o nível de API que o seu app precisa, leia o artigo Compatibilidade com diferentes versões de plataforma.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)