GlanceWearWidgetManager

class GlanceWearWidgetManager


Manager for Glance Wear Widgets.

This is used to query the wear widgets currently active on the system.

Summary

Public constructors

Creates a new GlanceWearWidgetManager, providing an interface to check which tiles or widgets are currently present on the system surfaces.

Public functions

suspend List<ActiveWearWidgetHandle>

Returns all currently active widgets and tiles associated with the calling package.

Public constructors

GlanceWearWidgetManager

Added in 1.0.0-alpha05
GlanceWearWidgetManager(context: Context)

Creates a new GlanceWearWidgetManager, providing an interface to check which tiles or widgets are currently present on the system surfaces.

This instance is designed for reuse and can be maintained as a singleton within your application.

Parameters
context: Context

The application context.

Public functions

fetchActiveWidgets

suspend fun fetchActiveWidgets(): List<ActiveWearWidgetHandle>

Returns all currently active widgets and tiles associated with the calling package.

A widget or a tile instance is active when it was added by the user to a widget or tile surface.

This includes:

Note: A ContainerInfo.CONTAINER_TYPE_FULLSCREEN result represents either a standard TileService or a GlanceWearWidgetService running in compatibility mode.

Legacy Behavior (Pre-API 34): On SDKs prior to Android 14 (U), this method uses a best-effort approach to approximate platform behavior and may be incomplete. Results may omit pre-installed tiles or widgets, tiles or widgets not visited within the last 60 days, or all tiles or widgets if the user has cleared app data. Conversely, tiles or widgets removed via an app update may incorrectly persist as "active" for up to 60 days post-removal.