Langsung ke konten

Paling sering dikunjungi

Terakhir dikunjungi

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:

Situs ini menggunakan cookies untuk menyimpan preferensi Anda tentang bahasa di situs tertentu dan opsi tampilan.

Dapatkan berita dan tips terbaru dari developer Android yang akan membantu Anda mencapai kesuksesan di Google Play.

* Wajib Diisi

Hore!

Ikuti Google Developers di WeChat

Buka situs ini dalam bahasa ?

Anda meminta halaman dalam bahasa , namun preferensi bahasa untuk situs ini adalah .

Ingin mengubah preferensi bahasa dan mengakses situs ini dalam bahasa ? Jika nanti Anda ingin mengubah preferensi bahasa, gunakan menu bahasa di bagian bawah setiap halaman.

Kelas ini memerlukan tingkat API atau yang lebih tinggi

Dokumen ini tersembunyi karena level API yang Anda pilih untuk dokumentasi ini adalah . Anda dapat mengubah level API dokumentasi dengan pemilih di atas menu navigasi sebelah kiri.

Untuk informasi lebih lanjut tentang menentukan level API yang diperlukan aplikasi Anda, baca Mendukung Versi Platform Yang Berbeda.

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