Ever-present and useful: Build... Note

Ever-present and useful: Building complication data sources for Wear OS

Wear OS complications provide small, glanceable information on watch faces, enhancing app engagement. Apps supply complication data sources; watch faces handle layout and rendering. Complication data is typed, with watch faces specifying supported types and defining slots for complications. Data types include SHORT_TEXT, SMALL_IMAGE, GOAL_PROGRESS, and RANGED_VALUE, suitable for bite-sized data, not large amounts or frequent updates. Creating a complication involves extending SuspendingComplicationDataSourceService and defining ComplicationData objects. Updates can be push-based (periodic) or pull-based (app-driven), using UPDATE_PERIOD_SECONDS or ComplicationDataSourceUpdateRequester. Platform bindings offer dynamic, high-frequency data updates for scenarios like fitness tracking, saving battery life. User configuration allows customization of displayed data, achieved through a configuration activity and metadata in the manifest. Efficient time handling uses SuspendingTimelineComplicationDataSourceService for event-based data or built-in classes for time-based data. Tracking complication activation and deactivation optimizes resource usage and aids user onboarding.